- Timestamp:
- Mar 19, 2021, 9:15:03 AM (4 years ago)
- Location:
- trunk/BNC
- Files:
-
- 172 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_abstract_legend.h
r8127 r9383 22 22 23 23 Legends, that need to be under control of the QwtPlot layout system 24 need to be derived from QwtAbstractLegend. 24 need to be derived from QwtAbstractLegend. 25 25 26 26 \note Other type of legends can be implemented by connecting to … … 45 45 \param painter Painter 46 46 \param rect Bounding rectangle 47 \param fillBackground When true, fill rect with the widget background 47 \param fillBackground When true, fill rect with the widget background 48 48 49 49 \sa renderLegend() is used by QwtPlotRenderer 50 50 */ 51 virtual void renderLegend( QPainter *painter, 51 virtual void renderLegend( QPainter *painter, 52 52 const QRectF &rect, bool fillBackground ) const = 0; 53 53 … … 65 65 \param data List of legend entry attributes for the item 66 66 */ 67 virtual void updateLegend( const QVariant &itemInfo, 67 virtual void updateLegend( const QVariant &itemInfo, 68 68 const QList<QwtLegendData> &data ) = 0; 69 69 }; 70 70 71 #endif 71 #endif -
trunk/BNC/qwt/qwt_abstract_scale.cpp
r8127 r9383 72 72 73 73 \sa lowerBound(), setScale(), setUpperBound() 74 \note For inverted scales the lower bound 74 \note For inverted scales the lower bound 75 75 is greater than the upper bound 76 76 */ … … 95 95 96 96 \sa upperBound(), setScale(), setLowerBound() 97 \note For inverted scales the lower bound 97 \note For inverted scales the lower bound 98 98 is greater than the upper bound 99 99 */ … … 115 115 \brief Specify a scale. 116 116 117 Define a scale by an interval 118 119 The ticks are calculated using scaleMaxMinor(), 117 Define a scale by an interval 118 119 The ticks are calculated using scaleMaxMinor(), 120 120 scaleMaxMajor() and scaleStepSize(). 121 121 … … 123 123 \param upperBound upper limit of the scale interval 124 124 125 \note For inverted scales the lower bound 125 \note For inverted scales the lower bound 126 126 is greater than the upper bound 127 127 */ … … 136 136 Define a scale by an interval 137 137 138 The ticks are calculated using scaleMaxMinor(), 138 The ticks are calculated using scaleMaxMinor(), 139 139 scaleMaxMajor() and scaleStepSize(). 140 140 … … 343 343 344 344 The scale division might have been assigned explicitly 345 or calculated implicitly by rescale(). 345 or calculated implicitly by rescale(). 346 346 */ 347 347 const QwtScaleDiv &QwtAbstractScale::scaleDiv() const … … 361 361 Translate a scale value into a widget coordinate 362 362 363 \param value Scale value 363 \param value Scale value 364 364 \return Corresponding widget coordinate for value 365 365 \sa scaleMap(), invTransform() … … 425 425 \sa scaleChange() 426 426 */ 427 void QwtAbstractScale::rescale( 427 void QwtAbstractScale::rescale( 428 428 double lowerBound, double upperBound, double stepSize ) 429 429 { -
trunk/BNC/qwt/qwt_abstract_scale.h
r8127 r9383 28 28 29 29 The scale division might be assigned explicitly - but usually 30 it is calculated from the boundaries using a QwtScaleEngine. 30 it is calculated from the boundaries using a QwtScaleEngine. 31 31 32 The scale engine also decides the type of transformation of the scale 32 The scale engine also decides the type of transformation of the scale 33 33 ( linear, logarithmic ... ). 34 34 */ … … 86 86 87 87 protected: 88 void rescale( double lowerBound, 88 void rescale( double lowerBound, 89 89 double upperBound, double stepSize ); 90 90 -
trunk/BNC/qwt/qwt_abstract_scale_draw.cpp
r8127 r9383 26 26 minExtent( 0.0 ) 27 27 { 28 components = QwtAbstractScaleDraw::Backbone 29 | QwtAbstractScaleDraw::Ticks 28 components = QwtAbstractScaleDraw::Backbone 29 | QwtAbstractScaleDraw::Ticks 30 30 | QwtAbstractScaleDraw::Labels; 31 31 … … 198 198 painter->save(); 199 199 200 QPenpen = painter->pen();200 pen = painter->pen(); 201 201 pen.setColor( palette.color( QPalette::WindowText ) ); 202 202 pen.setCapStyle( Qt::FlatCap ); … … 227 227 painter->save(); 228 228 229 QPenpen = painter->pen();229 pen = painter->pen(); 230 230 pen.setColor( palette.color( QPalette::WindowText ) ); 231 231 pen.setCapStyle( Qt::FlatCap ); … … 393 393 const QFont &font, double value ) const 394 394 { 395 QMap<double, QwtText>::const_iterator it = d_data->labelCache.find( value ); 396 if ( it == d_data->labelCache.end() ) 397 { 398 QwtText lbl = label( value ); 399 lbl.setRenderFlags( 0 ); 400 lbl.setLayoutAttribute( QwtText::MinimumLayout ); 401 402 ( void )lbl.textSize( font ); // initialize the internal cache 403 404 it = d_data->labelCache.insert( value, lbl ); 405 } 406 407 return ( *it ); 395 QMap<double, QwtText>::const_iterator it1 = d_data->labelCache.constFind( value ); 396 if ( it1 != d_data->labelCache.constEnd() ) 397 return *it1; 398 399 QwtText lbl = label( value ); 400 lbl.setRenderFlags( 0 ); 401 lbl.setLayoutAttribute( QwtText::MinimumLayout ); 402 403 ( void )lbl.textSize( font ); // initialize the internal cache 404 405 QMap<double, QwtText>::iterator it2 = d_data->labelCache.insert( value, lbl ); 406 return *it2; 408 407 } 409 408 -
trunk/BNC/qwt/qwt_abstract_scale_draw.h
r8127 r9383 55 55 virtual ~QwtAbstractScaleDraw(); 56 56 57 void setScaleDiv( const QwtScaleDiv & s);57 void setScaleDiv( const QwtScaleDiv & ); 58 58 const QwtScaleDiv& scaleDiv() const; 59 59 … … 69 69 double maxTickLength() const; 70 70 71 void setSpacing( double margin);71 void setSpacing( double ); 72 72 double spacing() const; 73 73 -
trunk/BNC/qwt/qwt_abstract_slider.cpp
r8127 r9383 18 18 #endif 19 19 20 static double qwtAlignToScaleDiv( 20 static double qwtAlignToScaleDiv( 21 21 const QwtAbstractSlider *slider, double value ) 22 22 { … … 28 28 return sd.lowerBound(); 29 29 30 if ( tValue == slider->transform( sd. lowerBound() ) )30 if ( tValue == slider->transform( sd.upperBound() ) ) 31 31 return sd.upperBound(); 32 32 … … 107 107 } 108 108 109 /*! 109 /*! 110 110 Set the value to be valid/invalid 111 111 … … 122 122 123 123 Q_EMIT valueChanged( d_data->value ); 124 } 125 } 124 } 125 } 126 126 127 127 //! \return True, when the value is invalid … … 129 129 { 130 130 return d_data->isValid; 131 } 131 } 132 132 133 133 /*! … … 168 168 \brief Enables or disables tracking. 169 169 170 If tracking is enabled, the slider emits the valueChanged() 171 signal while the movable part of the slider is being dragged. 172 If tracking is disabled, the slider emits the valueChanged() signal 170 If tracking is enabled, the slider emits the valueChanged() 171 signal while the movable part of the slider is being dragged. 172 If tracking is disabled, the slider emits the valueChanged() signal 173 173 only when the user releases the slider. 174 174 … … 288 288 Wheel Event handler 289 289 290 In/decreases the value by s number of steps. The direction 290 In/decreases the value by s number of steps. The direction 291 291 depends on the invertedControls() property. 292 292 … … 459 459 460 460 The range of the slider is divided into a number of steps from 461 which the value increments according to user inputs depend. 461 which the value increments according to user inputs depend. 462 462 463 463 The default setting is 100. … … 485 485 486 486 The range of the slider is divided into a number of steps from 487 which the value increments according to user inputs depend. 487 which the value increments according to user inputs depend. 488 488 489 489 \param stepCount Number of steps … … 495 495 { 496 496 d_data->singleSteps = stepCount; 497 } 497 } 498 498 499 499 /*! … … 504 504 { 505 505 return d_data->singleSteps; 506 } 507 508 /*! 506 } 507 508 /*! 509 509 \brief Set the number of steps for a page increment 510 510 511 511 The range of the slider is divided into a number of steps from 512 which the value increments according to user inputs depend. 512 which the value increments according to user inputs depend. 513 513 514 514 \param stepCount Number of steps … … 541 541 */ 542 542 void QwtAbstractSlider::setStepAlignment( bool on ) 543 { 543 { 544 544 if ( on != d_data->stepAlignment ) 545 545 { 546 546 d_data->stepAlignment = on; 547 547 } 548 } 549 548 } 549 550 550 /*! 551 551 \return True, when step alignment is enabled … … 586 586 587 587 /*! 588 If wrapping is true stepping up from upperBound() value will 589 take you to the minimum() value and vice versa. 588 If wrapping is true stepping up from upperBound() value will 589 take you to the minimum() value and vice versa. 590 590 591 591 \param on En/Disable wrapping … … 595 595 { 596 596 d_data->wrapping = on; 597 } 597 } 598 598 599 599 /*! 600 600 \return True, when wrapping is set 601 601 \sa setWrapping() 602 */ 602 */ 603 603 bool QwtAbstractSlider::wrapping() const 604 604 { … … 609 609 Invert wheel and key events 610 610 611 Usually scrolling the mouse wheel "up" and using keys like page 612 up will increase the slider's value towards its maximum. 611 Usually scrolling the mouse wheel "up" and using keys like page 612 up will increase the slider's value towards its maximum. 613 613 When invertedControls() is enabled the value is scrolled 614 614 towards its minimum. … … 645 645 void QwtAbstractSlider::incrementValue( int stepCount ) 646 646 { 647 const double value = incrementedValue( 647 const double value = incrementedValue( 648 648 d_data->value, stepCount ); 649 649 … … 656 656 657 657 /*! 658 Increment a value 659 660 \param value Value 658 Increment a value 659 660 \param value Value 661 661 \param stepCount Number of steps 662 662 663 663 \return Incremented value 664 664 */ 665 double QwtAbstractSlider::incrementedValue( 665 double QwtAbstractSlider::incrementedValue( 666 666 double value, int stepCount ) const 667 667 { … … 684 684 // we need equidant steps according to 685 685 // paint device coordinates 686 const double range = transformation->transform( maximum() ) 686 const double range = transformation->transform( maximum() ) 687 687 - transformation->transform( minimum() ); 688 688 … … 691 691 double v = transformation->transform( value ); 692 692 693 v = qRound( v / stepSize ) * stepSize; 693 v = qRound( v / stepSize ) * stepSize; 694 694 v += stepCount * range / d_data->totalSteps; 695 695 … … 757 757 if ( stepSize > 0.0 ) 758 758 { 759 value = lowerBound() + 759 value = lowerBound() + 760 760 qRound( ( value - lowerBound() ) / stepSize ) * stepSize; 761 761 } -
trunk/BNC/qwt/qwt_abstract_slider.h
r8127 r9383 18 18 19 19 A slider widget displays a value according to a scale. 20 The class is designed as a common super class for widgets like 20 The class is designed as a common super class for widgets like 21 21 QwtKnob, QwtDial and QwtSlider. 22 22 23 When the slider is nor readOnly() its value can be modified 24 by keyboard, mouse and wheel inputs. 23 When the slider is nor readOnly() its value can be modified 24 by keyboard, mouse and wheel inputs. 25 25 26 26 The range of the slider is divided into a number of steps from 27 which the value increments according to user inputs depend. 27 which the value increments according to user inputs depend. 28 28 Only for linear scales the number of steps correspond with 29 29 a fixed step size. … … 68 68 uint pageSteps() const; 69 69 70 void setStepAlignment( bool ); 70 void setStepAlignment( bool ); 71 71 bool stepAlignment() const; 72 72 … … 81 81 82 82 public Q_SLOTS: 83 void setValue( double val );83 void setValue( double value ); 84 84 85 85 Q_SIGNALS: … … 88 88 \brief Notify a change of value. 89 89 90 When tracking is enabled (default setting), 91 this signal will be emitted every time the value changes. 90 When tracking is enabled (default setting), 91 this signal will be emitted every time the value changes. 92 92 93 93 \param value New value … … 147 147 virtual double scrolledTo( const QPoint &pos ) const = 0; 148 148 149 void incrementValue( int numSteps);149 void incrementValue( int stepCount ); 150 150 151 151 virtual void scaleChange(); … … 154 154 virtual void sliderChange(); 155 155 156 double incrementedValue( 156 double incrementedValue( 157 157 double value, int stepCount ) const; 158 158 -
trunk/BNC/qwt/qwt_analog_clock.cpp
r8127 r9383 53 53 setTotalSteps( 60 ); 54 54 55 const int secondsPerHour = 60.0 * 60.0; 55 const int secondsPerHour = 60.0 * 60.0; 56 56 57 57 QList<double> majorTicks; … … 73 73 74 74 QColor knobColor = palette().color( QPalette::Active, QPalette::Text ); 75 knobColor = knobColor.dark ( 120 );75 knobColor = knobColor.darker( 120 ); 76 76 77 77 QColor handColor; … … 83 83 { 84 84 width = 2; 85 handColor = knobColor.dark ( 120 );85 handColor = knobColor.darker( 120 ); 86 86 } 87 87 else … … 201 201 { 202 202 const double hours = value() / ( 60.0 * 60.0 ); 203 const double minutes = 203 const double minutes = 204 204 ( value() - qFloor(hours) * 60.0 * 60.0 ) / 60.0; 205 205 const double seconds = value() - qFloor(hours) * 60.0 * 60.0 … … 214 214 { 215 215 const double d = 360.0 - angle[hand] - origin(); 216 drawHand( painter, static_cast<Hand>( hand ), 216 drawHand( painter, static_cast<Hand>( hand ), 217 217 center, radius, d, colorGroup ); 218 218 } -
trunk/BNC/qwt/qwt_analog_clock.h
r8127 r9383 22 22 23 23 \par Example 24 \code 24 \code 25 25 #include <qwt_analog_clock.h> 26 26 -
trunk/BNC/qwt/qwt_arrow_button.h
r8127 r9383 36 36 virtual void paintEvent( QPaintEvent *event ); 37 37 38 virtual void drawButtonLabel( QPainter * p);38 virtual void drawButtonLabel( QPainter * ); 39 39 virtual void drawArrow( QPainter *, 40 40 const QRect &, Qt::ArrowType ) const; -
trunk/BNC/qwt/qwt_clipper.cpp
r8127 r9383 151 151 } 152 152 153 inline void reset() 154 { 155 m_size = 0; 156 } 157 158 inline int size() const 159 { 160 return m_size; 161 } 162 163 inline Point *data() const 164 { 165 return m_buffer; 166 } 167 168 inline Point &operator[]( int i ) 169 { 170 return m_buffer[i]; 171 } 172 173 inline const Point &operator[]( int i ) const 174 { 175 return m_buffer[i]; 153 inline void reset() 154 { 155 m_size = 0; 156 } 157 158 inline int size() const 159 { 160 return m_size; 161 } 162 163 inline Point *data() const 164 { 165 return m_buffer; 166 } 167 168 inline Point &operator[]( int i ) 169 { 170 return m_buffer[i]; 171 } 172 173 inline const Point &operator[]( int i ) const 174 { 175 return m_buffer[i]; 176 176 } 177 177 … … 193 193 m_capacity *= 2; 194 194 195 m_buffer = static_cast<Point *>( 195 m_buffer = static_cast<Point *>( 196 196 ::realloc( m_buffer, m_capacity * sizeof( Point ) ) ); 197 197 } -
trunk/BNC/qwt/qwt_clipper.h
r8127 r9383 26 26 { 27 27 public: 28 static QPolygon clipPolygon( const QRect &, 28 static QPolygon clipPolygon( const QRect &, 29 29 const QPolygon &, bool closePolygon = false ); 30 static QPolygon clipPolygon( const QRectF &, 30 static QPolygon clipPolygon( const QRectF &, 31 31 const QPolygon &, bool closePolygon = false ); 32 32 33 static QPolygonF clipPolygonF( const QRectF &, 33 static QPolygonF clipPolygonF( const QRectF &, 34 34 const QPolygonF &, bool closePolygon = false ); 35 35 -
trunk/BNC/qwt/qwt_color_map.cpp
r8127 r9383 47 47 a = qAlpha( rgb ); 48 48 49 /* 50 when mapping a value to rgb we will have to calcualate: 49 /* 50 when mapping a value to rgb we will have to calcualate: 51 51 - const int v = int( ( s1.v0 + ratio * s1.vStep ) + 0.5 ); 52 52 … … 346 346 QColor QwtLinearColorMap::color1() const 347 347 { 348 return QColor ( d_data->colorStops.rgb( d_data->mode, 0.0 ) );348 return QColor::fromRgba( d_data->colorStops.rgb( d_data->mode, 0.0 ) ); 349 349 } 350 350 … … 355 355 QColor QwtLinearColorMap::color2() const 356 356 { 357 return QColor ( d_data->colorStops.rgb( d_data->mode, 1.0 ) );357 return QColor::fromRgba( d_data->colorStops.rgb( d_data->mode, 1.0 ) ); 358 358 } 359 359 -
trunk/BNC/qwt/qwt_color_map.h
r8127 r9383 107 107 108 108 QwtLinearColorMap( QwtColorMap::Format = QwtColorMap::RGB ); 109 QwtLinearColorMap( const QColor & from, const QColor &to,109 QwtLinearColorMap( const QColor &color1, const QColor &color2, 110 110 QwtColorMap::Format = QwtColorMap::RGB ); 111 111 … … 185 185 { 186 186 const unsigned int index = colorIndex( interval, value ); 187 return colorTable( interval )[index]; // slow 187 188 const QVector<QRgb> rgbTable = colorTable( interval ); 189 return rgbTable[index]; // slow 188 190 } 189 191 } -
trunk/BNC/qwt/qwt_column_symbol.cpp
r8127 r9383 115 115 style( QwtColumnSymbol::Box ), 116 116 frameStyle( QwtColumnSymbol::Raised ), 117 palette( Qt::gray ), 117 118 lineWidth( 2 ) 118 119 { 119 palette = QPalette( Qt::gray );120 120 } 121 121 … … 288 288 default: 289 289 { 290 painter->fillRect( r , d_data->palette.window() );291 } 292 } 293 } 290 painter->fillRect( r.adjusted( 0, 0, 1, 1 ), d_data->palette.window() ); 291 } 292 } 293 } -
trunk/BNC/qwt/qwt_column_symbol.h
r8127 r9383 137 137 virtual ~QwtColumnSymbol(); 138 138 139 void setFrameStyle( FrameStyle style);139 void setFrameStyle( FrameStyle ); 140 140 FrameStyle frameStyle() const; 141 141 -
trunk/BNC/qwt/qwt_compass.cpp
r8127 r9383 18 18 #include <qevent.h> 19 19 20 /*! 20 /*! 21 21 \brief Constructor 22 22 … … 49 49 } 50 50 51 /*! 51 /*! 52 52 \brief Constructor 53 53 … … 96 96 or returns an null text. 97 97 98 \return Label , or QString::null98 \return Label 99 99 \sa labelMap(), setLabelMap() 100 100 */ -
trunk/BNC/qwt/qwt_compass_rose.cpp
r8127 r9383 12 12 #include "qwt_painter.h" 13 13 #include <qpainter.h> 14 15 static QPointF qwtIntersection( 14 #include <qpainterpath.h> 15 16 static QPointF qwtIntersection( 16 17 QPointF p11, QPointF p12, QPointF p21, QPointF p22 ) 17 18 { … … 213 214 } 214 215 215 /*! 216 /*! 216 217 \return Width of the rose 217 218 \sa setWidth() -
trunk/BNC/qwt/qwt_compass_rose.h
r8127 r9383 46 46 \param colorGroup Color group 47 47 */ 48 virtual void draw( QPainter *painter, 48 virtual void draw( QPainter *painter, 49 49 const QPointF ¢er, double radius, double north, 50 50 QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0; … … 63 63 virtual ~QwtSimpleCompassRose(); 64 64 65 void setWidth( double w);65 void setWidth( double ); 66 66 double width() const; 67 67 68 void setNumThorns( int count);68 void setNumThorns( int ); 69 69 int numThorns() const; 70 70 71 void setNumThornLevels( int count);71 void setNumThornLevels( int ); 72 72 int numThornLevels() const; 73 73 … … 79 79 80 80 static void drawRose( QPainter *, const QPalette &, 81 const QPointF ¢er, double radius, double origin, double width,81 const QPointF ¢er, double radius, double north, double width, 82 82 int numThorns, int numThornLevels, double shrinkFactor ); 83 83 … … 87 87 }; 88 88 89 #endif 89 #endif -
trunk/BNC/qwt/qwt_counter.cpp
r8127 r9383 51 51 52 52 /*! 53 The counter is initialized with a range is set to [0.0, 1.0] with 53 The counter is initialized with a range is set to [0.0, 1.0] with 54 54 0.01 as single step size. The value is invalid. 55 55 … … 83 83 layout->addWidget( btn ); 84 84 85 connect( btn, SIGNAL( released() ), SLOT( btnReleased()) );86 connect( btn, SIGNAL( clicked() ), SLOT( btnClicked()) );85 connect( btn, SIGNAL(released()), SLOT(btnReleased()) ); 86 connect( btn, SIGNAL(clicked()), SLOT(btnClicked()) ); 87 87 88 88 d_data->buttonDown[i] = btn; … … 94 94 layout->addWidget( d_data->valueEdit ); 95 95 96 connect( d_data->valueEdit, SIGNAL( editingFinished() ), 97 SLOT( textChanged() ) ); 96 connect( d_data->valueEdit, SIGNAL(editingFinished()), SLOT(textChanged()) ); 98 97 99 98 layout->setStretchFactor( d_data->valueEdit, 10 ); … … 107 106 layout->addWidget( btn ); 108 107 109 connect( btn, SIGNAL( released() ), SLOT( btnReleased()) );110 connect( btn, SIGNAL( clicked() ), SLOT( btnClicked()) );108 connect( btn, SIGNAL(released()), SLOT(btnReleased()) ); 109 connect( btn, SIGNAL(clicked()), SLOT(btnClicked()) ); 111 110 112 111 d_data->buttonUp[i] = btn; … … 131 130 } 132 131 133 /*! 132 /*! 134 133 Set the counter to be in valid/invalid state 135 134 … … 137 136 the buttons are disabled. 138 137 139 \param on If true the counter will be set as valid 138 \param on If true the counter will be set as valid 140 139 141 140 \sa setValue(), isValid() … … 156 155 else 157 156 { 158 d_data->valueEdit->setText( QString ::null);159 } 160 } 161 } 162 163 /*! 157 d_data->valueEdit->setText( QString() ); 158 } 159 } 160 } 161 162 /*! 164 163 \return True, if the value is valid 165 164 \sa setValid(), setValue() … … 168 167 { 169 168 return d_data->isValid; 170 } 169 } 171 170 172 171 /*! … … 181 180 } 182 181 183 /*! 182 /*! 184 183 \return True, when the line line edit is read only. (default is no) 185 184 \sa setReadOnly() … … 335 334 \brief En/Disable wrapping 336 335 337 If wrapping is true stepping up from maximum() value will take 338 you to the minimum() value and vice versa. 336 If wrapping is true stepping up from maximum() value will take 337 you to the minimum() value and vice versa. 339 338 340 339 \param on En/Disable wrapping -
trunk/BNC/qwt/qwt_counter.h
r8127 r9383 25 25 and a step size. When the wrapping property is set 26 26 the counter is circular. 27 28 The number of steps by which a button increments or decrements the value 29 can be specified using setIncSteps(). The number of buttons can be 27 28 The number of steps by which a button increments or decrements the value 29 can be specified using setIncSteps(). The number of buttons can be 30 30 changed with setNumButtons(). 31 31 … … 92 92 void setReadOnly( bool ); 93 93 94 void setNumButtons( int n);94 void setNumButtons( int ); 95 95 int numButtons() const; 96 96 97 void setIncSteps( QwtCounter::Button btn, int nSteps );98 int incSteps( QwtCounter::Button btn) const;97 void setIncSteps( QwtCounter::Button, int numSteps ); 98 int incSteps( QwtCounter::Button ) const; 99 99 100 100 virtual QSize sizeHint() const; 101 101 102 102 double singleStep() const; 103 void setSingleStep( double s );103 void setSingleStep( double stepSize ); 104 104 105 105 void setRange( double min, double max ); 106 106 107 107 double minimum() const; 108 void setMinimum( double min);108 void setMinimum( double ); 109 109 110 110 double maximum() const; 111 void setMaximum( double max);111 void setMaximum( double ); 112 112 113 113 void setStepButton1( int nSteps ); -
trunk/BNC/qwt/qwt_curve_fitter.cpp
r8127 r9383 334 334 335 335 /*! 336 337 \return Maximum for the number of points passed to a run 336 \return Maximum for the number of points passed to a run 338 337 of the algorithm - or 0, when unlimited 339 338 \sa setChunkSize() … … 350 349 QPolygonF QwtWeedingCurveFitter::fitCurve( const QPolygonF &points ) const 351 350 { 351 if ( points.isEmpty() ) 352 return points; 353 352 354 QPolygonF fittedPoints; 353 354 355 if ( d_data->chunkSize == 0 ) 355 356 { -
trunk/BNC/qwt/qwt_curve_fitter.h
r8127 r9383 78 78 QwtSpline &spline(); 79 79 80 void setSplineSize( int size);80 void setSplineSize( int ); 81 81 int splineSize() const; 82 82 -
trunk/BNC/qwt/qwt_date.cpp
r8127 r9383 32 32 #endif 33 33 34 static QString qwtExpandedFormat( const QString & format, 34 static QString qwtExpandedFormat( const QString & format, 35 35 const QDateTime &dateTime, QwtDate::Week0Type week0Type ) 36 36 { … … 195 195 } 196 196 197 static inline void qwtFloorTime( 197 static inline void qwtFloorTime( 198 198 QwtDate::IntervalType intervalType, QDateTime &dt ) 199 199 { … … 224 224 dt.setTime( QTime( t.hour(), 0, 0 ) ); 225 225 break; 226 } 226 } 227 227 default: 228 228 break; … … 233 233 } 234 234 235 static inline QDateTime qwtToTimeSpec( 235 static inline QDateTime qwtToTimeSpec( 236 236 const QDateTime &dt, Qt::TimeSpec spec ) 237 237 { … … 255 255 } 256 256 257 #if 0 258 257 259 static inline double qwtToJulianDay( int year, int month, int day ) 258 260 { … … 280 282 if ( a < 0 ) 281 283 a -= b - 1; 282 284 283 285 return a / b; 284 } 286 } 287 288 #endif 285 289 286 290 static inline QDate qwtToDate( int year, int month = 1, int day = 1 ) … … 319 323 Translate from double to QDateTime 320 324 321 \param value Number of milliseconds since the epoch, 325 \param value Number of milliseconds since the epoch, 322 326 1970-01-01T00:00:00 UTC 323 327 \param timeSpec Time specification … … 373 377 374 378 const QTime time = dt.time(); 375 const double secs = 3600.0 * time.hour() + 379 const double secs = 3600.0 * time.hour() + 376 380 60.0 * time.minute() + time.second(); 377 381 … … 383 387 384 388 \param dateTime Datetime value 385 \param intervalType Interval type, how to ceil. 389 \param intervalType Interval type, how to ceil. 386 390 F.e. when intervalType = QwtDate::Months, the result 387 391 will be ceiled to the next beginning of a month … … 451 455 { 452 456 dt.setTime( QTime( 0, 0 ) ); 453 dt.setDate( qwtToDate( dateTime.date().year(), 457 dt.setDate( qwtToDate( dateTime.date().year(), 454 458 dateTime.date().month() ) ); 455 459 … … 484 488 485 489 \param dateTime Datetime value 486 \param intervalType Interval type, how to ceil. 490 \param intervalType Interval type, how to ceil. 487 491 F.e. when intervalType = QwtDate::Months, 488 the result will be ceiled to the next 492 the result will be ceiled to the next 489 493 beginning of a month 490 494 \return Floored datetime 491 495 \sa floor() 492 496 */ 493 QDateTime QwtDate::floor( const QDateTime &dateTime, 497 QDateTime QwtDate::floor( const QDateTime &dateTime, 494 498 IntervalType intervalType ) 495 499 { … … 533 537 dt.setTime( QTime( 0, 0 ) ); 534 538 535 const QDate date = qwtToDate( dt.date().year(), 539 const QDate date = qwtToDate( dt.date().year(), 536 540 dt.date().month() ); 537 541 dt.setDate( date ); … … 556 560 Minimum for the supported date range 557 561 558 The range of valid dates depends on how QDate stores the 562 The range of valid dates depends on how QDate stores the 559 563 Julian day internally. 560 564 … … 577 581 Maximum for the supported date range 578 582 579 The range of valid dates depends on how QDate stores the 583 The range of valid dates depends on how QDate stores the 580 584 Julian day internally. 581 585 … … 600 604 601 605 The first day of a week depends on the current locale 602 ( QLocale::firstDayOfWeek() ). 606 ( QLocale::firstDayOfWeek() ). 603 607 604 608 \param year Year … … 607 611 608 612 \sa QLocale::firstDayOfWeek(), weekNumber() 609 */ 613 */ 610 614 QDate QwtDate::dateOfWeek0( int year, Week0Type type ) 611 615 { … … 624 628 { 625 629 // according to ISO 8601 the first week is defined 626 // by the first thursday. 630 // by the first thursday. 627 631 628 632 int d = Qt::Thursday - firstDayOfWeek; … … 641 645 642 646 - QwtDate::FirstThursday\n 643 Corresponding to ISO 8601 ( see QDate::weekNumber() ). 647 Corresponding to ISO 8601 ( see QDate::weekNumber() ). 644 648 645 649 - QwtDate::FirstDay\n … … 737 741 week number with a leading zero ( 01 - 53 ) 738 742 739 As week 1 usually starts in the previous year a special rule 743 As week 1 usually starts in the previous year a special rule 740 744 is applied for formats, where the year is expected to match the 741 745 week number - even if the date belongs to the previous year. -
trunk/BNC/qwt/qwt_date.h
r8127 r9383 23 23 A double is interpreted as the number of milliseconds since 24 24 1970-01-01T00:00:00 Universal Coordinated Time - also known 25 as "The Epoch". 25 as "The Epoch". 26 26 27 While the range of the Julian day in Qt4 is limited to [0, MAX_INT], 28 Qt5 stores it as qint64 offering a huge range of valid dates. 29 As the significance of a double is below this ( assuming a 30 fraction of 52 bits ) the translation is not 31 bijective with rounding errors for dates very far from Epoch. 32 For a resolution of 1 ms those start to happen for dates above the 33 year 144683. 27 While the range of the Julian day in Qt4 is limited to [0, MAX_INT], 28 Qt5 stores it as qint64 offering a huge range of valid dates. 29 As the significance of a double is below this ( assuming a 30 fraction of 52 bits ) the translation is not 31 bijective with rounding errors for dates very far from Epoch. 32 For a resolution of 1 ms those start to happen for dates above the 33 year 144683. 34 34 35 35 An axis for a date/time interval is expected to be aligned … … 43 43 { 44 44 public: 45 /*! 45 /*! 46 46 How to identify the first week of year differs between 47 countries. 47 countries. 48 48 */ 49 49 enum Week0Type … … 60 60 /*! 61 61 "The week with January 1.1 in it." 62 62 63 63 In the U.S. this definition is more common than 64 64 FirstThursday. … … 67 67 }; 68 68 69 /*! 69 /*! 70 70 Classification of an time interval 71 71 … … 109 109 static QDate maxDate(); 110 110 111 static QDateTime toDateTime( double value, 111 static QDateTime toDateTime( double value, 112 112 Qt::TimeSpec = Qt::UTC ); 113 113 … … 122 122 static int utcOffset( const QDateTime & ); 123 123 124 static QString toString( const QDateTime &, 124 static QString toString( const QDateTime &, 125 125 const QString & format, Week0Type ); 126 126 }; -
trunk/BNC/qwt/qwt_date_scale_draw.cpp
r8127 r9383 37 37 \brief Constructor 38 38 39 The default setting is to display tick labels for the 39 The default setting is to display tick labels for the 40 40 given time specification. The first week of a year is defined like 41 41 for QwtDate::FirstThursday. … … 110 110 \sa week0Type(). 111 111 \note week0Type has no effect beside for intervals classified as 112 QwtDate::Week. 112 QwtDate::Week. 113 113 */ 114 114 void QwtDateScaleDraw::setWeek0Type( QwtDate::Week0Type week0Type ) … … 118 118 119 119 /*! 120 \return Setting how to identify the first week of a year. 120 \return Setting how to identify the first week of a year. 121 121 \sa setWeek0Type() 122 122 */ … … 134 134 \sa dateFormat(), dateFormatOfDate(), QwtDate::toString() 135 135 */ 136 void QwtDateScaleDraw::setDateFormat( 136 void QwtDateScaleDraw::setDateFormat( 137 137 QwtDate::IntervalType intervalType, const QString &format ) 138 138 { 139 if ( intervalType >= QwtDate::Millisecond && 139 if ( intervalType >= QwtDate::Millisecond && 140 140 intervalType <= QwtDate::Year ) 141 141 { … … 149 149 \sa setDateFormat(), dateFormatOfDate() 150 150 */ 151 QString QwtDateScaleDraw::dateFormat( 151 QString QwtDateScaleDraw::dateFormat( 152 152 QwtDate::IntervalType intervalType ) const 153 153 { 154 if ( intervalType >= QwtDate::Millisecond && 154 if ( intervalType >= QwtDate::Millisecond && 155 155 intervalType <= QwtDate::Year ) 156 156 { … … 158 158 } 159 159 160 return QString ::null;160 return QString(); 161 161 } 162 162 … … 182 182 Q_UNUSED( dateTime ) 183 183 184 if ( intervalType >= QwtDate::Millisecond && 184 if ( intervalType >= QwtDate::Millisecond && 185 185 intervalType <= QwtDate::Year ) 186 186 { … … 205 205 { 206 206 const QDateTime dt = toDateTime( value ); 207 const QString fmt = dateFormatOfDate( 207 const QString fmt = dateFormatOfDate( 208 208 dt, intervalType( scaleDiv() ) ); 209 209 … … 220 220 \sa dateFormatOfDate() 221 221 */ 222 QwtDate::IntervalType QwtDateScaleDraw::intervalType( 222 QwtDate::IntervalType QwtDateScaleDraw::intervalType( 223 223 const QwtScaleDiv &scaleDiv ) const 224 224 { … … 233 233 for ( int j = QwtDate::Second; j <= intvType; j++ ) 234 234 { 235 const QDateTime dt0 = QwtDate::floor( dt, 235 const QDateTime dt0 = QwtDate::floor( dt, 236 236 static_cast<QwtDate::IntervalType>( j ) ); 237 237 -
trunk/BNC/qwt/qwt_date_scale_draw.h
r8127 r9383 73 73 74 74 protected: 75 virtual QwtDate::IntervalType 75 virtual QwtDate::IntervalType 76 76 intervalType( const QwtScaleDiv & ) const; 77 77 -
trunk/BNC/qwt/qwt_date_scale_engine.cpp
r8127 r9383 14 14 #include <limits.h> 15 15 16 static inline double qwtMsecsForType( QwtDate::IntervalTypetype )16 static inline double qwtMsecsForType( int type ) 17 17 { 18 18 static const double msecs[] = … … 44 44 45 45 static double qwtIntervalWidth( const QDateTime &minDate, 46 const QDateTime &maxDate, QwtDate::IntervalType intervalType ) 46 const QDateTime &maxDate, QwtDate::IntervalType intervalType ) 47 47 { 48 48 switch( intervalType ) … … 80 80 case QwtDate::Month: 81 81 { 82 const double years = 82 const double years = 83 83 double( maxDate.date().year() ) - minDate.date().year(); 84 84 … … 91 91 case QwtDate::Year: 92 92 { 93 double years = 93 double years = 94 94 double( maxDate.date().year() ) - minDate.date().year(); 95 95 … … 104 104 } 105 105 106 static double qwtRoundedIntervalWidth( 107 const QDateTime &minDate, const QDateTime &maxDate, 108 QwtDate::IntervalType intervalType ) 106 static double qwtRoundedIntervalWidth( 107 const QDateTime &minDate, const QDateTime &maxDate, 108 QwtDate::IntervalType intervalType ) 109 109 { 110 110 const QDateTime minD = QwtDate::floor( minDate, intervalType ); … … 131 131 } 132 132 133 static int qwtStepSize( int intervalSize, int maxSteps, uint base ) 133 static int qwtStepSize( int intervalSize, int maxSteps, uint base ) 134 134 { 135 135 if ( maxSteps <= 0 ) … … 162 162 } 163 163 164 static int qwtDivideInterval( double intervalSize, int numSteps, 164 static int qwtDivideInterval( double intervalSize, int numSteps, 165 165 const int limits[], size_t numLimits ) 166 166 { … … 181 181 if ( intervalType != QwtDate::Day ) 182 182 { 183 if ( ( intervalSize > numSteps ) && 183 if ( ( intervalSize > numSteps ) && 184 184 ( intervalSize <= 2 * numSteps ) ) 185 185 { … … 196 196 { 197 197 static int limits[] = { 1, 2, 5, 10, 15, 20, 30, 60 }; 198 198 199 199 stepSize = qwtDivideInterval( intervalSize, numSteps, 200 200 limits, sizeof( limits ) / sizeof( int ) ); … … 205 205 { 206 206 static int limits[] = { 1, 2, 3, 4, 6, 12, 24 }; 207 207 208 208 stepSize = qwtDivideInterval( intervalSize, numSteps, 209 209 limits, sizeof( limits ) / sizeof( int ) ); … … 274 274 if ( stepSize > maxMinSteps ) 275 275 { 276 numSteps = qwtStepCount( stepSize, maxMinSteps, 276 numSteps = qwtStepCount( stepSize, maxMinSteps, 277 277 limits, sizeof( limits ) / sizeof( int ) ); 278 278 … … 280 280 else 281 281 { 282 numSteps = qwtStepCount( stepSize * 60, maxMinSteps, 282 numSteps = qwtStepCount( stepSize * 60, maxMinSteps, 283 283 limits, sizeof( limits ) / sizeof( int ) ); 284 284 } … … 359 359 else 360 360 { 361 minStepSize = QwtScaleArithmetic::divideInterval( 361 minStepSize = QwtScaleArithmetic::divideInterval( 362 362 stepSizeInWeeks, maxMinSteps, 10 ); 363 363 } … … 401 401 minStepSize = double( stepSize ) / numSteps; 402 402 } 403 403 404 404 break; 405 405 } … … 445 445 } 446 446 447 static QwtScaleDiv qwtDivideToSeconds( 447 static QwtScaleDiv qwtDivideToSeconds( 448 448 const QDateTime &minDate, const QDateTime &maxDate, 449 449 double stepSize, int maxMinSteps, 450 QwtDate::IntervalType intervalType ) 450 QwtDate::IntervalType intervalType ) 451 451 { 452 452 // calculate the min step size 453 453 double minStepSize = 0; 454 454 455 if ( maxMinSteps > 1 ) 456 { 457 minStepSize = qwtDivideMajorStep( stepSize, 455 if ( maxMinSteps > 1 ) 456 { 457 minStepSize = qwtDivideMajorStep( stepSize, 458 458 maxMinSteps, intervalType ); 459 459 } … … 472 472 const int secondsMajor = static_cast<int>( stepSize * s ); 473 473 const double secondsMinor = minStepSize * s; 474 474 475 475 // UTC excludes daylight savings. So from the difference 476 476 // of a date and its UTC counterpart we can find out … … 484 484 QList<double> minorTicks; 485 485 486 for ( QDateTime dt = minDate; dt <= maxDate; 486 for ( QDateTime dt = minDate; dt <= maxDate; 487 487 dt = dt.addSecs( secondsMajor ) ) 488 488 { … … 501 501 // we add some minor ticks for the DST hour, 502 502 // otherwise the ticks will be unaligned: 0, 2, 3, 5 ... 503 minorTicks += qwtDstTicks( 503 minorTicks += qwtDstTicks( 504 504 dt, secondsMajor, qRound( secondsMinor ) ); 505 505 } … … 517 517 for ( int i = 1; i < numMinorSteps; i++ ) 518 518 { 519 const QDateTime mt = dt.addMSecs( 519 const QDateTime mt = dt.addMSecs( 520 520 qRound64( i * secondsMinor * 1000 ) ); 521 521 … … 529 529 if ( minorTicks.isEmpty() || minorTicks.last() != minorValue ) 530 530 { 531 const bool isMedium = ( numMinorSteps % 2 == 0 ) 531 const bool isMedium = ( numMinorSteps % 2 == 0 ) 532 532 && ( i != 1 ) && ( i == numMinorSteps / 2 ); 533 533 … … 553 553 } 554 554 555 static QwtScaleDiv qwtDivideToMonths( 555 static QwtScaleDiv qwtDivideToMonths( 556 556 QDateTime &minDate, const QDateTime &maxDate, 557 double stepSize, int maxMinSteps ) 558 { 559 // months are intervals with non 560 // equidistant ( in ms ) steps: we have to build the 557 double stepSize, int maxMinSteps ) 558 { 559 // months are intervals with non 560 // equidistant ( in ms ) steps: we have to build the 561 561 // scale division manually 562 562 563 563 int minStepDays = 0; 564 int minStepSize = 0.0; 564 int minStepSize = 0.0; 565 565 566 566 if ( maxMinSteps > 1 ) … … 579 579 else 580 580 { 581 minStepSize = qwtDivideMajorStep( 581 minStepSize = qwtDivideMajorStep( 582 582 stepSize, maxMinSteps, QwtDate::Month ); 583 583 } … … 588 588 QList<double> minorTicks; 589 589 590 for ( QDateTime dt = minDate; 590 for ( QDateTime dt = minDate; 591 591 dt <= maxDate; dt = dt.addMonths( stepSize ) ) 592 592 { … … 598 598 if ( minStepDays > 0 ) 599 599 { 600 for ( int days = minStepDays; 600 for ( int days = minStepDays; 601 601 days < 30; days += minStepDays ) 602 602 { … … 637 637 } 638 638 639 static QwtScaleDiv qwtDivideToYears( 639 static QwtScaleDiv qwtDivideToYears( 640 640 const QDateTime &minDate, const QDateTime &maxDate, 641 double stepSize, int maxMinSteps ) 641 double stepSize, int maxMinSteps ) 642 642 { 643 643 QList<double> majorTicks; … … 649 649 if ( maxMinSteps > 1 ) 650 650 { 651 minStepSize = qwtDivideMajorStep( 651 minStepSize = qwtDivideMajorStep( 652 652 stepSize, maxMinSteps, QwtDate::Year ); 653 653 } … … 702 702 break; 703 703 } 704 } 704 } 705 705 706 706 QwtScaleDiv scaleDiv; … … 730 730 QwtDate::Week0Type week0Type; 731 731 int maxWeeks; 732 }; 732 }; 733 733 734 734 … … 736 736 \brief Constructor 737 737 738 The engine is initialized to build scales for the 738 The engine is initialized to build scales for the 739 739 given time specification. It classifies intervals > 4 weeks 740 740 as >= Qt::Month. The first week of a year is defined like … … 811 811 \sa week0Type(), setMaxWeeks() 812 812 \note week0Type has no effect beside for intervals classified as 813 QwtDate::Week. 813 QwtDate::Week. 814 814 */ 815 815 void QwtDateScaleEngine::setWeek0Type( QwtDate::Week0Type week0Type ) … … 819 819 820 820 /*! 821 \return Setting how to identify the first week of a year. 821 \return Setting how to identify the first week of a year. 822 822 \sa setWeek0Type(), maxWeeks() 823 823 */ … … 835 835 \param weeks Upper limit for the number of weeks 836 836 837 \note In business charts a year is often d evided837 \note In business charts a year is often divided 838 838 into weeks [1-52] 839 \sa maxWeeks(), setWeek0Type() 839 \sa maxWeeks(), setWeek0Type() 840 840 */ 841 841 void QwtDateScaleEngine::setMaxWeeks( int weeks ) … … 863 863 \return Interval classification 864 864 */ 865 QwtDate::IntervalType QwtDateScaleEngine::intervalType( 866 const QDateTime &minDate, const QDateTime &maxDate, 865 QwtDate::IntervalType QwtDateScaleEngine::intervalType( 866 const QDateTime &minDate, const QDateTime &maxDate, 867 867 int maxSteps ) const 868 868 { … … 910 910 Align and divide an interval 911 911 912 The algorithm aligns and divides the interval into steps. 912 The algorithm aligns and divides the interval into steps. 913 913 914 914 Datetime interval divisions are usually not equidistant and the 915 915 calculated stepSize can only be used as an approximation 916 for the steps calculated by divideScale(). 916 for the steps calculated by divideScale(). 917 917 918 918 \param maxNumSteps Max. number of steps … … 951 951 maxNumSteps = 1; 952 952 953 const QwtDate::IntervalType intvType = 953 const QwtDate::IntervalType intvType = 954 954 intervalType( from, to, maxNumSteps ); 955 955 … … 1015 1015 } 1016 1016 1017 const QwtDate::IntervalType intvType = 1017 const QwtDate::IntervalType intvType = 1018 1018 intervalType( from, to, maxMajorSteps ); 1019 1019 … … 1031 1031 const QDateTime maxDate = QwtDate::ceil( to, intvType ); 1032 1032 1033 scaleDiv = buildScaleDiv( minDate, maxDate, 1033 scaleDiv = buildScaleDiv( minDate, maxDate, 1034 1034 maxMajorSteps, maxMinorSteps, intvType ); 1035 1035 … … 1046 1046 } 1047 1047 1048 QwtScaleDiv QwtDateScaleEngine::buildScaleDiv( 1048 QwtScaleDiv QwtDateScaleEngine::buildScaleDiv( 1049 1049 const QDateTime &minDate, const QDateTime &maxDate, 1050 1050 int maxMajorSteps, int maxMinorSteps, … … 1052 1052 { 1053 1053 // calculate the step size 1054 const double stepSize = qwtDivideScale( 1055 qwtIntervalWidth( minDate, maxDate, intervalType ), 1054 const double stepSize = qwtDivideScale( 1055 qwtIntervalWidth( minDate, maxDate, intervalType ), 1056 1056 maxMajorSteps, intervalType ); 1057 1057 … … 1060 1060 if ( !dt0.isValid() ) 1061 1061 { 1062 // the floored date is out of the range of a 1062 // the floored date is out of the range of a 1063 1063 // QDateTime - we ceil instead. 1064 1064 dt0 = alignDate( minDate, stepSize, intervalType, true ); … … 1069 1069 if ( intervalType <= QwtDate::Week ) 1070 1070 { 1071 scaleDiv = qwtDivideToSeconds( dt0, maxDate, 1071 scaleDiv = qwtDivideToSeconds( dt0, maxDate, 1072 1072 stepSize, maxMinorSteps, intervalType ); 1073 1073 } … … 1094 1094 1095 1095 For Qt::Day alignments there is no "natural day 0" - 1096 instead the first day of the year is used to avoid jumping 1096 instead the first day of the year is used to avoid jumping 1097 1097 major ticks positions when panning a scale. For other alignments 1098 1098 ( f.e according to the first day of the month ) alignDate() … … 1106 1106 \return Aligned date/time value 1107 1107 */ 1108 QDateTime QwtDateScaleEngine::alignDate( 1109 const QDateTime &dateTime, double stepSize, 1108 QDateTime QwtDateScaleEngine::alignDate( 1109 const QDateTime &dateTime, double stepSize, 1110 1110 QwtDate::IntervalType intervalType, bool up ) const 1111 1111 { … … 1123 1123 case QwtDate::Millisecond: 1124 1124 { 1125 const int ms = qwtAlignValue( 1125 const int ms = qwtAlignValue( 1126 1126 dt.time().msec(), stepSize, up ) ; 1127 1127 … … 1293 1293 if ( !dt.isValid() ) 1294 1294 { 1295 const QDate date = ( value <= 0.0 ) 1295 const QDate date = ( value <= 0.0 ) 1296 1296 ? QwtDate::minDate() : QwtDate::maxDate(); 1297 1297 -
trunk/BNC/qwt/qwt_date_scale_engine.h
r8127 r9383 28 28 QwtDateScaleEngine supports representations depending 29 29 on Qt::TimeSpec specifications. The valid range for scales 30 is limited by the range of QDateTime, that differs 30 is limited by the range of QDateTime, that differs 31 31 between Qt4 and Qt5. 32 32 33 33 Datetime values are expected as the number of milliseconds since 34 34 1970-01-01T00:00:00 Universal Coordinated Time - also known 35 as "The Epoch", that can be converted to QDateTime using 35 as "The Epoch", that can be converted to QDateTime using 36 36 QwtDate::toDateTime(). 37 37 … … 53 53 void setWeek0Type( QwtDate::Week0Type ); 54 54 QwtDate::Week0Type week0Type() const; 55 55 56 56 void setMaxWeeks( int ); 57 57 int maxWeeks() const; … … 60 60 double &x1, double &x2, double &stepSize ) const; 61 61 62 virtual QwtScaleDiv divideScale( 62 virtual QwtScaleDiv divideScale( 63 63 double x1, double x2, 64 64 int maxMajorSteps, int maxMinorSteps, 65 65 double stepSize = 0.0 ) const; 66 66 67 virtual QwtDate::IntervalType intervalType( 67 virtual QwtDate::IntervalType intervalType( 68 68 const QDateTime &, const QDateTime &, int maxSteps ) const; 69 69 … … 76 76 private: 77 77 QwtScaleDiv buildScaleDiv( const QDateTime &, const QDateTime &, 78 int maxMajorSteps, int maxMinorSteps, 78 int maxMajorSteps, int maxMinorSteps, 79 79 QwtDate::IntervalType ) const; 80 80 -
trunk/BNC/qwt/qwt_dial.cpp
r8127 r9383 238 238 const QRect cr = contentsRect(); 239 239 240 const doubledim = qMin( cr.width(), cr.height() );240 const int dim = qMin( cr.width(), cr.height() ); 241 241 242 242 QRect inner( 0, 0, dim, dim ); … … 338 338 p.setRenderHint( QPainter::Antialiasing, true ); 339 339 p.translate( -r.topLeft() ); 340 340 341 341 if ( d_data->mode != QwtDial::RotateScale ) 342 342 drawContents( &p ); … … 475 475 \param radius Radius of the scale 476 476 */ 477 void QwtDial::drawScale( QPainter *painter, 477 void QwtDial::drawScale( QPainter *painter, 478 478 const QPointF ¢er, double radius ) const 479 479 { … … 568 568 569 569 The motivation for setting a scale draw is often 570 to overload QwtRoundScaleDraw::label() to return 570 to overload QwtRoundScaleDraw::label() to return 571 571 individual tick labels. 572 572 573 573 \param scaleDraw Scale draw 574 574 \warning The previous scale draw is deleted … … 601 601 maxScaleArc = minScaleArc + 360.0; 602 602 603 if ( ( minScaleArc != d_data->minScaleArc ) || 603 if ( ( minScaleArc != d_data->minScaleArc ) || 604 604 ( maxScaleArc != d_data->maxScaleArc ) ) 605 605 { … … 612 612 } 613 613 614 /*! 614 /*! 615 615 Set the lower limit for the scale arc 616 616 … … 623 623 } 624 624 625 /*! 625 /*! 626 626 \return Lower limit of the scale arc 627 627 \sa setScaleArc() … … 632 632 } 633 633 634 /*! 634 /*! 635 635 Set the upper limit for the scale arc 636 636 … … 643 643 } 644 644 645 /*! 645 /*! 646 646 \return Upper limit of the scale arc 647 647 \sa setScaleArc() … … 691 691 const int d = 6 * sh + 2 * lineWidth(); 692 692 693 QSize hint( d, d ); 693 QSize hint( d, d ); 694 694 if ( !isReadOnly() ) 695 695 hint = hint.expandedTo( QApplication::globalStrut() ); … … 718 718 \param pos Mouse position 719 719 720 \retval True, when the inner circle contains pos 720 \retval True, when the inner circle contains pos 721 721 \sa scrolledTo() 722 722 */ … … 730 730 angle = 360.0 - angle; 731 731 732 double valueAngle = 732 double valueAngle = 733 733 qwtNormalizeDegrees( 90.0 - scaleMap().transform( value() ) ); 734 734 … … 775 775 if ( qAbs( arc ) > 180.0 ) 776 776 { 777 boundedAngle = ( arc > 0 ) 777 boundedAngle = ( arc > 0 ) 778 778 ? scaleMap().p1() : scaleMap().p2(); 779 779 } … … 821 821 break; 822 822 } 823 823 824 824 QwtAbstractSlider::changeEvent( event ); 825 825 } … … 847 847 848 848 /*! 849 Invalidate the internal caches and call 849 Invalidate the internal caches and call 850 850 QwtAbstractSlider::scaleChange() 851 851 */ -
trunk/BNC/qwt/qwt_dial.h
r8127 r9383 104 104 Mode mode() const; 105 105 106 void setScaleArc( double min , double max);106 void setScaleArc( double minArc, double maxArc ); 107 107 108 void setMinScaleArc( double min);108 void setMinScaleArc( double ); 109 109 double minScaleArc() const; 110 110 111 void setMaxScaleArc( double min);111 void setMaxScaleArc( double ); 112 112 double maxScaleArc() const; 113 113 … … 137 137 virtual void changeEvent( QEvent * ); 138 138 139 virtual void drawFrame( QPainter * p);139 virtual void drawFrame( QPainter * ); 140 140 virtual void drawContents( QPainter * ) const; 141 141 virtual void drawFocusIndicator( QPainter * ) const; … … 143 143 void invalidateCache(); 144 144 145 virtual void drawScale( QPainter *, 145 virtual void drawScale( QPainter *, 146 146 const QPointF ¢er, double radius ) const; 147 147 148 virtual void drawScaleContents( QPainter *painter, 148 virtual void drawScaleContents( QPainter *painter, 149 149 const QPointF ¢er, double radius ) const; 150 150 -
trunk/BNC/qwt/qwt_dial_needle.cpp
r8127 r9383 14 14 #include <qapplication.h> 15 15 #include <qpainter.h> 16 #include <qpainterpath.h> 16 17 17 18 #if QT_VERSION < 0x040601 … … 67 68 } 68 69 69 static void qwtDrawShadedPointer( QPainter *painter, 70 static void qwtDrawShadedPointer( QPainter *painter, 70 71 const QColor &lightColor, const QColor &darkColor, 71 72 double length, double width ) … … 171 172 172 173 QColor color[4]; 173 color[0] = darkColor.light ( 100 + colorOffset );174 color[1] = darkColor.dark ( 100 + colorOffset );175 color[2] = lightColor.light ( 100 + colorOffset );176 color[3] = lightColor.dark ( 100 + colorOffset );174 color[0] = darkColor.lighter( 100 + colorOffset ); 175 color[1] = darkColor.darker( 100 + colorOffset ); 176 color[2] = lightColor.lighter( 100 + colorOffset ); 177 color[3] = lightColor.darker( 100 + colorOffset ); 177 178 178 179 painter->setPen( Qt::NoPen ); … … 223 224 \param colorGroup Color group, used for painting 224 225 */ 225 void QwtDialNeedle::draw( QPainter *painter, 226 const QPointF ¢er, double length, double direction, 226 void QwtDialNeedle::draw( QPainter *painter, 227 const QPointF ¢er, double length, double direction, 227 228 QPalette::ColorGroup colorGroup ) const 228 229 { … … 316 317 \param colorGroup Color group, used for painting 317 318 */ 318 void QwtDialSimpleNeedle::drawNeedle( QPainter *painter, 319 void QwtDialSimpleNeedle::drawNeedle( QPainter *painter, 319 320 double length, QPalette::ColorGroup colorGroup ) const 320 321 { … … 327 328 width = qMax(length * 0.06, 6.0); 328 329 329 qwtDrawArrowNeedle( painter, 330 qwtDrawArrowNeedle( painter, 330 331 palette(), colorGroup, length, width ); 331 332 … … 336 337 if ( width <= 0.0 ) 337 338 width = 5.0; 338 339 339 340 QPen pen ( palette().brush( colorGroup, QPalette::Mid ), width ); 340 341 pen.setCapStyle( Qt::FlatCap ); 341 342 342 343 painter->setPen( pen ); 343 344 painter->drawLine( QPointF( 0.0, 0.0 ), QPointF( length, 0.0 ) ); … … 373 374 \param colorGroup Color group, used for painting 374 375 */ 375 void QwtCompassMagnetNeedle::drawNeedle( QPainter *painter, 376 void QwtCompassMagnetNeedle::drawNeedle( QPainter *painter, 376 377 double length, QPalette::ColorGroup colorGroup ) const 377 378 { … … 386 387 387 388 qwtDrawShadedPointer( painter, 388 dark.light ( 100 + colorOffset ),389 dark.dark ( 100 + colorOffset ),389 dark.lighter( 100 + colorOffset ), 390 dark.darker( 100 + colorOffset ), 390 391 length, width ); 391 392 392 393 painter->rotate( 180.0 ); 393 394 394 395 qwtDrawShadedPointer( painter, 395 light.light ( 100 + colorOffset ),396 light.dark ( 100 + colorOffset ),396 light.lighter( 100 + colorOffset ), 397 light.darker( 100 + colorOffset ), 397 398 length, width ); 398 399 399 400 const QBrush baseBrush = palette().brush( colorGroup, QPalette::Base ); 400 401 drawKnob( painter, width, baseBrush, true ); … … 431 432 \param colorGroup Color group, used for painting 432 433 */ 433 void QwtCompassWindArrow::drawNeedle( QPainter *painter, 434 void QwtCompassWindArrow::drawNeedle( QPainter *painter, 434 435 double length, QPalette::ColorGroup colorGroup ) const 435 436 { -
trunk/BNC/qwt/qwt_dial_needle.h
r8127 r9383 36 36 37 37 virtual void draw( QPainter *painter, const QPointF ¢er, 38 double length, double direction, 38 double length, double direction, 39 39 QPalette::ColorGroup = QPalette::Active ) const; 40 40 … … 44 44 45 45 The origin of the needle is at position (0.0, 0.0 ) 46 pointing in direction 0.0 ( = east ). 46 pointing in direction 0.0 ( = east ). 47 47 48 The painter is already initialized with translation and 48 The painter is already initialized with translation and 49 49 rotation. 50 50 … … 55 55 \sa setPalette(), palette() 56 56 */ 57 virtual void drawNeedle( QPainter *painter, 57 virtual void drawNeedle( QPainter *painter, 58 58 double length, QPalette::ColorGroup colorGroup ) const = 0; 59 59 60 virtual void drawKnob( QPainter *, double width, 60 virtual void drawKnob( QPainter *, double width, 61 61 const QBrush &, bool sunken ) const; 62 62 … … 133 133 TriangleStyle, 134 134 135 //! A thin needle 135 //! A thin needle 136 136 ThinStyle 137 137 }; … … 141 141 142 142 protected: 143 virtual void drawNeedle( QPainter *, 143 virtual void drawNeedle( QPainter *, 144 144 double length, QPalette::ColorGroup ) const; 145 145 … … 178 178 179 179 protected: 180 virtual void drawNeedle( QPainter *, 180 virtual void drawNeedle( QPainter *, 181 181 double length, QPalette::ColorGroup ) const; 182 182 … … 185 185 }; 186 186 187 #endif 187 #endif -
trunk/BNC/qwt/qwt_dyngrid_layout.cpp
r8127 r9383 126 126 } 127 127 128 /*! 128 /*! 129 129 \brief Add an item to the next free position. 130 130 \param item Layout item … … 248 248 249 249 /*! 250 \brief Calculate the number of columns for a given width. 251 252 The calculation tries to use as many columns as possible 250 \brief Calculate the number of columns for a given width. 251 252 The calculation tries to use as many columns as possible 253 253 ( limited by maxColumns() ) 254 254 … … 264 264 265 265 uint maxColumns = itemCount(); 266 if ( d_data->maxColumns > 0 ) 266 if ( d_data->maxColumns > 0 ) 267 267 maxColumns = qMin( d_data->maxColumns, maxColumns ); 268 268 -
trunk/BNC/qwt/qwt_dyngrid_layout.h
r8127 r9383 29 29 Q_OBJECT 30 30 public: 31 explicit QwtDynGridLayout( QWidget *, int margin = 0, int spac e= -1 );32 explicit QwtDynGridLayout( int spac e= -1 );31 explicit QwtDynGridLayout( QWidget *, int margin = 0, int spacing = -1 ); 32 explicit QwtDynGridLayout( int spacing = -1 ); 33 33 34 34 virtual ~QwtDynGridLayout(); … … 36 36 virtual void invalidate(); 37 37 38 void setMaxColumns( uint maxCol s );38 void setMaxColumns( uint maxColumns ); 39 39 uint maxColumns() const; 40 40 … … 50 50 void setExpandingDirections( Qt::Orientations ); 51 51 virtual Qt::Orientations expandingDirections() const; 52 QList<QRect> layoutItems( const QRect &, uint numCol s ) const;52 QList<QRect> layoutItems( const QRect &, uint numColumns ) const; 53 53 54 54 virtual int maxItemWidth() const; … … 68 68 protected: 69 69 70 void layoutGrid( uint numCol s,70 void layoutGrid( uint numColumns, 71 71 QVector<int>& rowHeight, QVector<int>& colWidth ) const; 72 void stretchGrid( const QRect &rect, uint numCol s,72 void stretchGrid( const QRect &rect, uint numColumns, 73 73 QVector<int>& rowHeight, QVector<int>& colWidth ) const; 74 74 75 75 private: 76 76 void init(); 77 int maxRowWidth( int numCol s ) const;77 int maxRowWidth( int numColumns ) const; 78 78 79 79 class PrivateData; -
trunk/BNC/qwt/qwt_event_pattern.cpp
r8127 r9383 106 106 \sa QMouseEvent 107 107 */ 108 void QwtEventPattern::setMousePattern( MousePatternCode pattern, 108 void QwtEventPattern::setMousePattern( MousePatternCode pattern, 109 109 Qt::MouseButton button, Qt::KeyboardModifiers modifiers ) 110 110 { … … 125 125 \sa QKeyEvent 126 126 */ 127 void QwtEventPattern::setKeyPattern( KeyPatternCode pattern, 127 void QwtEventPattern::setKeyPattern( KeyPatternCode pattern, 128 128 int key, Qt::KeyboardModifiers modifiers ) 129 129 { … … 186 186 \sa keyMatch() 187 187 */ 188 bool QwtEventPattern::mouseMatch( MousePatternCode code, 188 bool QwtEventPattern::mouseMatch( MousePatternCode code, 189 189 const QMouseEvent *event ) const 190 190 { … … 232 232 \sa mouseMatch() 233 233 */ 234 bool QwtEventPattern::keyMatch( KeyPatternCode code, 234 bool QwtEventPattern::keyMatch( KeyPatternCode code, 235 235 const QKeyEvent *event ) const 236 236 { -
trunk/BNC/qwt/qwt_event_pattern.h
r8127 r9383 44 44 enum MousePatternCode 45 45 { 46 /*! 47 The default setting for 1, 2 and 3 button mice is: 48 49 - Qt::LeftButton 50 - Qt::LeftButton 51 - Qt::LeftButton 46 /*! 47 The default setting for 1, 2 and 3 button mice is: 48 49 - Qt::LeftButton 50 - Qt::LeftButton 51 - Qt::LeftButton 52 52 */ 53 53 MouseSelect1, … … 150 150 public: 151 151 //! Constructor 152 MousePattern( Qt::MouseButton btn = Qt::NoButton, 152 MousePattern( Qt::MouseButton btn = Qt::NoButton, 153 153 Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ): 154 154 button( btn ), … … 157 157 } 158 158 159 //! Button 159 //! Button 160 160 Qt::MouseButton button; 161 161 … … 169 169 public: 170 170 //! Constructor 171 KeyPattern( int keyCode = Qt::Key_unknown, 171 KeyPattern( int keyCode = Qt::Key_unknown, 172 172 Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ): 173 173 key( keyCode ), … … 189 189 void initKeyPattern(); 190 190 191 void setMousePattern( MousePatternCode, Qt::MouseButton button, 191 void setMousePattern( MousePatternCode, Qt::MouseButton button, 192 192 Qt::KeyboardModifiers = Qt::NoModifier ); 193 193 194 void setKeyPattern( KeyPatternCode, int key Code,195 Qt::KeyboardModifiers modifier Codes = Qt::NoModifier );194 void setKeyPattern( KeyPatternCode, int key, 195 Qt::KeyboardModifiers modifiers = Qt::NoModifier ); 196 196 197 197 void setMousePattern( const QVector<MousePattern> & ); -
trunk/BNC/qwt/qwt_global.h
r8127 r9383 15 15 // QWT_VERSION is (major << 16) + (minor << 8) + patch. 16 16 17 #define QWT_VERSION 0x06010 418 #define QWT_VERSION_STR "6.1. 4"17 #define QWT_VERSION 0x060106 18 #define QWT_VERSION_STR "6.1.6" 19 19 20 20 #if defined(_MSC_VER) /* MSVC Compiler */ … … 27 27 #ifdef QWT_DLL 28 28 29 #if defined(QWT_MAKEDLL) // create a Qwt DLL library 29 #if defined(QWT_MAKEDLL) // create a Qwt DLL library 30 30 #define QWT_EXPORT Q_DECL_EXPORT 31 31 #else // use a Qwt DLL library 32 #define QWT_EXPORT Q_DECL_IMPORT 32 #define QWT_EXPORT Q_DECL_IMPORT 33 33 #endif 34 34 … … 39 39 #endif 40 40 41 #endif 41 #endif -
trunk/BNC/qwt/qwt_graphic.cpp
r8127 r9383 38 38 } 39 39 40 static QRectF qwtStrokedPathRect( 40 static QRectF qwtStrokedPathRect( 41 41 const QPainter *painter, const QPainterPath &path ) 42 42 { … … 64 64 } 65 65 66 static inline void qwtExecCommand( 67 QPainter *painter, const QwtPainterCommand &cmd, 66 static inline void qwtExecCommand( 67 QPainter *painter, const QwtPainterCommand &cmd, 68 68 QwtGraphic::RenderHints renderHints, 69 69 const QTransform &transform, … … 122 122 { 123 123 const QwtPainterCommand::ImageData *data = cmd.imageData(); 124 painter->drawImage( data->rect, data->image, 124 painter->drawImage( data->rect, data->image, 125 125 data->subRect, data->flags ); 126 126 break; … … 130 130 const QwtPainterCommand::StateData *data = cmd.stateData(); 131 131 132 if ( data->flags & QPaintEngine::DirtyPen ) 132 if ( data->flags & QPaintEngine::DirtyPen ) 133 133 painter->setPen( data->pen ); 134 134 135 if ( data->flags & QPaintEngine::DirtyBrush ) 135 if ( data->flags & QPaintEngine::DirtyBrush ) 136 136 painter->setBrush( data->brush ); 137 137 138 if ( data->flags & QPaintEngine::DirtyBrushOrigin ) 138 if ( data->flags & QPaintEngine::DirtyBrushOrigin ) 139 139 painter->setBrushOrigin( data->brushOrigin ); 140 140 141 if ( data->flags & QPaintEngine::DirtyFont ) 141 if ( data->flags & QPaintEngine::DirtyFont ) 142 142 painter->setFont( data->font ); 143 143 144 if ( data->flags & QPaintEngine::DirtyBackground ) 144 if ( data->flags & QPaintEngine::DirtyBackground ) 145 145 { 146 146 painter->setBackgroundMode( data->backgroundMode ); … … 148 148 } 149 149 150 if ( data->flags & QPaintEngine::DirtyTransform ) 150 if ( data->flags & QPaintEngine::DirtyTransform ) 151 151 { 152 152 painter->setTransform( data->transform * transform ); 153 153 } 154 154 155 if ( data->flags & QPaintEngine::DirtyClipEnabled ) 155 if ( data->flags & QPaintEngine::DirtyClipEnabled ) 156 156 painter->setClipping( data->isClipEnabled ); 157 157 158 if ( data->flags & QPaintEngine::DirtyClipRegion) 158 if ( data->flags & QPaintEngine::DirtyClipRegion) 159 159 { 160 painter->setClipRegion( data->clipRegion, 160 painter->setClipRegion( data->clipRegion, 161 161 data->clipOperation ); 162 162 } 163 163 164 if ( data->flags & QPaintEngine::DirtyClipPath ) 164 if ( data->flags & QPaintEngine::DirtyClipPath ) 165 165 { 166 166 painter->setClipPath( data->clipPath, data->clipOperation ); 167 167 } 168 168 169 if ( data->flags & QPaintEngine::DirtyHints) 169 if ( data->flags & QPaintEngine::DirtyHints) 170 170 { 171 171 const QPainter::RenderHints hints = data->renderHints; … … 187 187 } 188 188 189 if ( data->flags & QPaintEngine::DirtyCompositionMode) 189 if ( data->flags & QPaintEngine::DirtyCompositionMode) 190 190 painter->setCompositionMode( data->compositionMode ); 191 191 192 if ( data->flags & QPaintEngine::DirtyOpacity) 192 if ( data->flags & QPaintEngine::DirtyOpacity) 193 193 painter->setOpacity( data->opacity ); 194 194 … … 210 210 } 211 211 212 PathInfo( const QRectF &pointRect, 212 PathInfo( const QRectF &pointRect, 213 213 const QRectF &boundingRect, bool scalablePen ): 214 214 d_pointRect( pointRect ), … … 247 247 } 248 248 249 inline double scaleFactorX( const QRectF& pathRect, 249 inline double scaleFactorX( const QRectF& pathRect, 250 250 const QRectF &targetRect, bool scalePens ) const 251 251 { … … 258 258 const double r = qAbs( pathRect.right() - p0.x() ); 259 259 260 const double w = 2.0 * qMin( l, r ) 260 const double w = 2.0 * qMin( l, r ) 261 261 * targetRect.width() / pathRect.width(); 262 262 … … 268 268 else 269 269 { 270 const double pw = qMax( 270 const double pw = qMax( 271 271 qAbs( d_boundingRect.left() - d_pointRect.left() ), 272 272 qAbs( d_boundingRect.right() - d_pointRect.right() ) ); … … 278 278 } 279 279 280 inline double scaleFactorY( const QRectF& pathRect, 280 inline double scaleFactorY( const QRectF& pathRect, 281 281 const QRectF &targetRect, bool scalePens ) const 282 282 { … … 289 289 const double b = qAbs( pathRect.bottom() - p0.y() ); 290 290 291 const double h = 2.0 * qMin( t, b ) 291 const double h = 2.0 * qMin( t, b ) 292 292 * targetRect.height() / pathRect.height(); 293 293 … … 299 299 else 300 300 { 301 const double pw = 301 const double pw = 302 302 qMax( qAbs( d_boundingRect.top() - d_pointRect.top() ), 303 303 qAbs( d_boundingRect.bottom() - d_pointRect.bottom() ) ); … … 352 352 \brief Copy constructor 353 353 354 \param other Source 354 \param other Source 355 355 \sa operator=() 356 356 */ … … 371 371 \brief Assignment operator 372 372 373 \param other Source 373 \param other Source 374 374 \return A reference of this object 375 375 */ … … 383 383 384 384 /*! 385 \brief Clear all stored commands 385 \brief Clear all stored commands 386 386 \sa isNull() 387 387 */ 388 void QwtGraphic::reset() 388 void QwtGraphic::reset() 389 389 { 390 390 d_data->commands.clear(); … … 460 460 461 461 /*! 462 The control point rectangle is the bounding rectangle 462 The control point rectangle is the bounding rectangle 463 463 of all control points of the paths and the target 464 464 rectangles of the images/pixmaps. … … 478 478 \brief Calculate the target rectangle for scaling the graphic 479 479 480 \param sx Horizontal scaling factor 481 \param sy Vertical scaling factor 482 483 \note In case of paths that are painted with a cosmetic pen 480 \param sx Horizontal scaling factor 481 \param sy Vertical scaling factor 482 483 \note In case of paths that are painted with a cosmetic pen 484 484 ( see QPen::isCosmetic() ) the target rectangle is different to 485 485 multiplying the bounding rectangle. … … 500 500 for ( int i = 0; i < d_data->pathInfos.size(); i++ ) 501 501 { 502 rect |= d_data->pathInfos[i].scaledBoundingRect( sx, sy, 502 rect |= d_data->pathInfos[i].scaledBoundingRect( sx, sy, 503 503 !d_data->renderHints.testFlag( RenderPensUnscaled ) ); 504 504 } … … 519 519 The default size is used in all methods rendering the graphic, 520 520 where no size is explicitly specified. Assigning an empty size 521 means, that the default size will be calculated from the bounding 521 means, that the default size will be calculated from the bounding 522 522 rectangle. 523 523 524 524 The default setting is an empty size. 525 525 526 526 \param size Default size 527 527 … … 544 544 545 545 The default size is used in all methods rendering the graphic, 546 where no size is explicitly specified. 546 where no size is explicitly specified. 547 547 548 548 \return Default size … … 575 575 for ( int i = 0; i < numCommands; i++ ) 576 576 { 577 qwtExecCommand( painter, commands[i], 577 qwtExecCommand( painter, commands[i], 578 578 d_data->renderHints, transform, d_data->initialTransform ); 579 579 } … … 592 592 \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode 593 593 */ 594 void QwtGraphic::render( QPainter *painter, const QSizeF &size, 594 void QwtGraphic::render( QPainter *painter, const QSizeF &size, 595 595 Qt::AspectRatioMode aspectRatioMode ) const 596 596 { … … 608 608 \param aspectRatioMode Mode how to scale - See Qt::AspectRatioMode 609 609 */ 610 void QwtGraphic::render( QPainter *painter, const QRectF &rect, 610 void QwtGraphic::render( QPainter *painter, const QRectF &rect, 611 611 Qt::AspectRatioMode aspectRatioMode ) const 612 612 { … … 614 614 return; 615 615 616 double sx = 1.0; 616 double sx = 1.0; 617 617 double sy = 1.0; 618 618 … … 623 623 sy = rect.height() / d_data->pointRect.height(); 624 624 625 const bool scalePens = 625 const bool scalePens = 626 626 !d_data->renderHints.testFlag( RenderPensUnscaled ); 627 627 … … 630 630 const PathInfo info = d_data->pathInfos[i]; 631 631 632 const double ssx = info.scaleFactorX( 632 const double ssx = info.scaleFactorX( 633 633 d_data->pointRect, rect, scalePens ); 634 634 … … 636 636 sx = qMin( sx, ssx ); 637 637 638 const double ssy = info.scaleFactorY( 638 const double ssy = info.scaleFactorY( 639 639 d_data->pointRect, rect, scalePens ); 640 640 … … 666 666 { 667 667 // we don't want to scale pens according to sx/sy, 668 // but we want to apply the scaling from the 668 // but we want to apply the scaling from the 669 669 // painter transformation later 670 670 … … 690 690 \param painter Qt painter 691 691 \param pos Reference point, where to render 692 \param alignment Flags how to align the target rectangle 692 \param alignment Flags how to align the target rectangle 693 693 to pos. 694 694 */ 695 void QwtGraphic::render( QPainter *painter, 695 void QwtGraphic::render( QPainter *painter, 696 696 const QPointF &pos, Qt::Alignment alignment ) const 697 697 { … … 729 729 /*! 730 730 \brief Convert the graphic to a QPixmap 731 731 732 732 All pixels of the pixmap get initialized by Qt::transparent 733 733 before the graphic is scaled and rendered on it. 734 734 735 735 The size of the pixmap is the default size ( ceiled to integers ) 736 736 of the graphic. … … 738 738 \return The graphic as pixmap in default size 739 739 \sa defaultSize(), toImage(), render() 740 */ 740 */ 741 741 QPixmap QwtGraphic::toPixmap() const 742 742 { … … 819 819 /*! 820 820 \brief Convert the graphic to a QImage 821 821 822 822 All pixels of the image get initialized by 0 ( transparent ) 823 823 before the graphic is scaled and rendered on it. … … 827 827 The size of the image is the default size ( ceiled to integers ) 828 828 of the graphic. 829 829 830 830 \return The graphic as image in default size 831 831 \sa defaultSize(), toPixmap(), render() … … 874 874 QRectF boundingRect = pointRect; 875 875 876 if ( painter->pen().style() != Qt::NoPen 876 if ( painter->pen().style() != Qt::NoPen 877 877 && painter->pen().brush().style() != Qt::NoBrush ) 878 878 { … … 883 883 updateBoundingRect( boundingRect ); 884 884 885 d_data->pathInfos += PathInfo( pointRect, 885 d_data->pathInfos += PathInfo( pointRect, 886 886 boundingRect, qwtHasScalablePen( painter ) ); 887 887 } … … 897 897 \sa QPaintEngine::drawPixmap() 898 898 */ 899 void QwtGraphic::drawPixmap( const QRectF &rect, 899 void QwtGraphic::drawPixmap( const QRectF &rect, 900 900 const QPixmap &pixmap, const QRectF &subRect ) 901 901 { … … 997 997 return; 998 998 999 // to calculate a proper bounding rectangle we don't simply copy 1000 // the commands. 999 // to calculate a proper bounding rectangle we don't simply copy 1000 // the commands. 1001 1001 1002 1002 const QwtPainterCommand *cmds = commands.constData(); -
trunk/BNC/qwt/qwt_graphic.h
r8127 r9383 37 37 - QSvgRenderer/QSvgGenerator\n 38 38 Unfortunately QSvgRenderer hides to much information about 39 its nodes in internal APIs, that are necessary for proper 40 layout calculations. Also it is derived from QObject and 39 its nodes in internal APIs, that are necessary for proper 40 layout calculations. Also it is derived from QObject and 41 41 can't be copied like QImage/QPixmap. 42 42 43 43 QwtGraphic maps all scalable drawing primitives to a QPainterPath 44 and stores them together with the painter state changes 45 ( pen, brush, transformation ... ) in a list of QwtPaintCommands. 46 For being a complete QPaintDevice it also stores pixmaps or images, 47 what is somehow against the idea of the class, because these objects 44 and stores them together with the painter state changes 45 ( pen, brush, transformation ... ) in a list of QwtPaintCommands. 46 For being a complete QPaintDevice it also stores pixmaps or images, 47 what is somehow against the idea of the class, because these objects 48 48 can't be scaled without a loss in quality. 49 49 50 50 The main issue about scaling a QwtGraphic object are the pens used for 51 drawing the outlines of the painter paths. While non cosmetic pens 52 ( QPen::isCosmetic() ) are scaled with the same ratio as the path, 53 cosmetic pens have a fixed width. A graphic might have paths with 51 drawing the outlines of the painter paths. While non cosmetic pens 52 ( QPen::isCosmetic() ) are scaled with the same ratio as the path, 53 cosmetic pens have a fixed width. A graphic might have paths with 54 54 different pens - cosmetic and non-cosmetic. 55 55 … … 58 58 - control point rectangle\n 59 59 The control point rectangle is the bounding rectangle of all 60 control point rectangles of the painter paths, or the target 60 control point rectangles of the painter paths, or the target 61 61 rectangle of the pixmaps/images. 62 62 … … 65 65 what is needed for rendering the outline with an unscaled pen. 66 66 67 Because the offset for drawing the outline depends on the shape 68 of the painter path ( the peak of a triangle is different than the flat side ) 69 scaling with a fixed aspect ratio always needs to be calculated from the 67 Because the offset for drawing the outline depends on the shape 68 of the painter path ( the peak of a triangle is different than the flat side ) 69 scaling with a fixed aspect ratio always needs to be calculated from the 70 70 control point rectangle. 71 71 … … 75 75 { 76 76 public: 77 /*! 77 /*! 78 78 Hint how to render a graphic 79 79 \sa setRenderHint(), testRenderHint() … … 82 82 { 83 83 /*! 84 When rendering a QwtGraphic a specific scaling between 84 When rendering a QwtGraphic a specific scaling between 85 85 the controlPointRect() and the coordinates of the target rectangle 86 86 is set up internally in render(). … … 96 96 }; 97 97 98 /*! 98 /*! 99 99 \brief Render hints 100 100 … … 117 117 void render( QPainter * ) const; 118 118 119 void render( QPainter *, const QSizeF &, 119 void render( QPainter *, const QSizeF &, 120 120 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const; 121 121 122 void render( QPainter *, const QRectF &, 122 void render( QPainter *, const QRectF &, 123 123 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const; 124 124 … … 126 126 Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const; 127 127 128 QPixmap toPixmap() const; 129 QPixmap toPixmap( const QSize &, 128 QPixmap toPixmap() const; 129 QPixmap toPixmap( const QSize &, 130 130 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const; 131 131 132 QImage toImage() const; 133 QImage toImage( const QSize &, 132 QImage toImage() const; 133 QImage toImage( const QSize &, 134 134 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const; 135 135 … … 144 144 void setDefaultSize( const QSizeF & ); 145 145 QSizeF defaultSize() const; 146 146 147 147 void setRenderHint( RenderHint, bool on = true ); 148 148 bool testRenderHint( RenderHint ) const; -
trunk/BNC/qwt/qwt_interval.cpp
r8127 r9383 131 131 } 132 132 133 /*! 133 /*! 134 134 \brief Intersect 2 intervals 135 135 136 136 \param other Interval to be intersect with 137 137 \return Intersection … … 198 198 } 199 199 200 /*! 200 /*! 201 201 \brief Unite this interval with the given interval. 202 202 … … 210 210 } 211 211 212 /*! 212 /*! 213 213 \brief Intersect this interval with the given interval. 214 214 -
trunk/BNC/qwt/qwt_interval.h
r8127 r9383 28 28 public: 29 29 /*! 30 Flag indicating if a border is included or excluded 30 Flag indicating if a border is included or excluded 31 31 \sa setBorderFlags(), borderFlags() 32 32 */ … … 58 58 QwtInterval normalized() const; 59 59 QwtInterval inverted() const; 60 QwtInterval limited( double minValue, double maxValue) const;60 QwtInterval limited( double lowerBound, double upperBound ) const; 61 61 62 62 bool operator==( const QwtInterval & ) const; … … 232 232 /*! 233 233 \brief Intersection of two intervals 234 234 235 235 \param other Interval to intersect with 236 236 \return Intersection of this and other … … 258 258 } 259 259 260 /*! 260 /*! 261 261 \brief Compare two intervals 262 262 … … 270 270 ( d_borderFlags == other.d_borderFlags ); 271 271 } 272 /*! 272 /*! 273 273 \brief Compare two intervals 274 274 -
trunk/BNC/qwt/qwt_interval_symbol.cpp
r8127 r9383 69 69 70 70 //! \brief Assignment operator 71 QwtIntervalSymbol &QwtIntervalSymbol::operator=( 71 QwtIntervalSymbol &QwtIntervalSymbol::operator=( 72 72 const QwtIntervalSymbol &other ) 73 73 { … … 77 77 78 78 //! \brief Compare two symbols 79 bool QwtIntervalSymbol::operator==( 79 bool QwtIntervalSymbol::operator==( 80 80 const QwtIntervalSymbol &other ) const 81 81 { … … 84 84 85 85 //! \brief Compare two symbols 86 bool QwtIntervalSymbol::operator!=( 86 bool QwtIntervalSymbol::operator!=( 87 87 const QwtIntervalSymbol &other ) const 88 88 { … … 153 153 } 154 154 155 /*! 155 /*! 156 156 Build and assign a pen 157 157 158 158 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 159 159 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced … … 163 163 \param width Pen width 164 164 \param style Pen style 165 165 166 166 \sa pen(), brush() 167 */ 168 void QwtIntervalSymbol::setPen( const QColor &color, 167 */ 168 void QwtIntervalSymbol::setPen( const QColor &color, 169 169 qreal width, Qt::PenStyle style ) 170 { 170 { 171 171 setPen( QPen( color, width, style ) ); 172 172 } … … 222 222 if ( d_data->width > pw ) 223 223 { 224 if ( ( orientation == Qt::Horizontal ) 224 if ( ( orientation == Qt::Horizontal ) 225 225 && ( p1.y() == p2.y() ) ) 226 226 { … … 233 233 p2.x(), y, p2.x(), y + sw ); 234 234 } 235 else if ( ( orientation == Qt::Vertical ) 235 else if ( ( orientation == Qt::Vertical ) 236 236 && ( p1.x() == p2.x() ) ) 237 237 { … … 274 274 else 275 275 { 276 if ( ( orientation == Qt::Horizontal ) 276 if ( ( orientation == Qt::Horizontal ) 277 277 && ( p1.y() == p2.y() ) ) 278 278 { -
trunk/BNC/qwt/qwt_interval_symbol.h
r8127 r9383 66 66 int width() const; 67 67 68 void setBrush( const QBrush & b);68 void setBrush( const QBrush & ); 69 69 const QBrush& brush() const; 70 70 … … 80 80 81 81 private: 82 83 82 class PrivateData; 84 83 PrivateData* d_data; -
trunk/BNC/qwt/qwt_knob.cpp
r8127 r9383 120 120 setValue( 0.0 ); 121 121 122 setSizePolicy( QSizePolicy::MinimumExpanding, 122 setSizePolicy( QSizePolicy::MinimumExpanding, 123 123 QSizePolicy::MinimumExpanding ); 124 124 } … … 131 131 132 132 /*! 133 \brief Set the knob type 133 \brief Set the knob type 134 134 135 135 \param knobStyle Knob type … … 186 186 have to be set using setNumTurns(). 187 187 188 The default angle is 270 degrees. 188 The default angle is 270 degrees. 189 189 190 190 \sa totalAngle(), setNumTurns() … … 206 206 } 207 207 208 /*! 208 /*! 209 209 \return the total angle 210 210 \sa setTotalAngle(), setNumTurns(), numTurns() … … 223 223 \sa numTurns(), totalAngle(), setTotalAngle() 224 224 */ 225 225 226 226 void QwtKnob::setNumTurns( int numTurns ) 227 227 { … … 245 245 246 246 /*! 247 \return Number of turns. 247 \return Number of turns. 248 248 249 249 When the total angle is below 360° numTurns() is ceiled to 1. … … 336 336 r.moveBottom( cr.bottom() - d ); 337 337 } 338 else 338 else 339 339 { 340 340 r.moveCenter( QPoint( r.center().x(), cr.center().y() ) ); … … 401 401 if ( !wrapping() ) 402 402 { 403 const double boundedAngle = 403 const double boundedAngle = 404 404 qBound( scaleMap().p1(), angle, scaleMap().p2() ); 405 405 … … 432 432 } 433 433 434 /*! 434 /*! 435 435 Handle QEvent::StyleChange and QEvent::FontChange; 436 436 \param event Change event … … 479 479 drawKnob( &painter, knobRect ); 480 480 481 drawMarker( &painter, knobRect, 481 drawMarker( &painter, knobRect, 482 482 qwtNormalizeDegrees( scaleMap().transform( value() ) ) ); 483 483 … … 514 514 gradient.setColorAt( 1.0, c2 ); 515 515 516 pen = QPen( gradient, d_data->borderWidth ); 516 pen = QPen( gradient, d_data->borderWidth ); 517 517 } 518 518 … … 525 525 QRadialGradient gradient( knobRect.center(), 526 526 knobRect.width(), knobRect.topLeft() + QPointF( off, off ) ); 527 527 528 528 gradient.setColorAt( 0.0, palette().color( QPalette::Midlight ) ); 529 529 gradient.setColorAt( 1.0, palette().color( QPalette::Button ) ); … … 553 553 case QwtKnob::Sunken: 554 554 { 555 QLinearGradient gradient( 555 QLinearGradient gradient( 556 556 knobRect.topLeft(), knobRect.bottomRight() ); 557 557 gradient.setColorAt( 0.0, palette().color( QPalette::Mid ) ); … … 578 578 \param painter Painter 579 579 \param rect Bounding rectangle of the knob without scale 580 \param angle Angle of the marker in degrees 580 \param angle Angle of the marker in degrees 581 581 ( clockwise, 0 at the 12 o'clock position ) 582 582 */ 583 void QwtKnob::drawMarker( QPainter *painter, 583 void QwtKnob::drawMarker( QPainter *painter, 584 584 const QRectF &rect, double angle ) const 585 585 { … … 608 608 case Nub: 609 609 { 610 const double dotWidth = 610 const double dotWidth = 611 611 qMin( double( markerSize ), radius); 612 612 … … 614 614 if ( dotCenterDist > 0.0 ) 615 615 { 616 const QPointF center( xm - sinA * dotCenterDist, 616 const QPointF center( xm - sinA * dotCenterDist, 617 617 ym - cosA * dotCenterDist ); 618 618 … … 626 626 qSwap( c1, c2 ); 627 627 628 QLinearGradient gradient( 628 QLinearGradient gradient( 629 629 ellipse.topLeft(), ellipse.bottomRight() ); 630 630 gradient.setColorAt( 0.0, c1 ); … … 640 640 case Dot: 641 641 { 642 const double dotWidth = 642 const double dotWidth = 643 643 qMin( double( markerSize ), radius); 644 644 … … 646 646 if ( dotCenterDist > 0.0 ) 647 647 { 648 const QPointF center( xm - sinA * dotCenterDist, 648 const QPointF center( xm - sinA * dotCenterDist, 649 649 ym - cosA * dotCenterDist ); 650 650 … … 681 681 painter->translate( rect.center() ); 682 682 painter->rotate( angle - 90.0 ); 683 683 684 684 QPolygonF polygon; 685 685 polygon += QPointF( re, 0.0 ); … … 705 705 */ 706 706 void QwtKnob::drawFocusIndicator( QPainter *painter ) const 707 { 707 { 708 708 const QRect cr = contentsRect(); 709 709 … … 723 723 724 724 QwtPainter::drawFocusRect( painter, this, focusRect ); 725 } 725 } 726 726 727 727 /*! … … 729 729 730 730 Similar to a QLabel::alignment() the flags decide how 731 to align the knob inside of contentsRect(). 731 to align the knob inside of contentsRect(). 732 732 733 733 The default setting is Qt::AlignCenter … … 758 758 \brief Change the knob's width. 759 759 760 Setting a fixed value for the diameter of the knob 760 Setting a fixed value for the diameter of the knob 761 761 is helpful for aligning several knobs in a row. 762 762 … … 764 764 765 765 \sa knobWidth(), setAlignment() 766 \note Modifies the sizePolicy() 766 \note Modifies the sizePolicy() 767 767 */ 768 768 void QwtKnob::setKnobWidth( int width ) … … 828 828 } 829 829 830 /*! 830 /*! 831 831 \return Marker size 832 832 \sa setMarkerSize() -
trunk/BNC/qwt/qwt_knob.h
r8127 r9383 26 26 The layout of the knob depends on the knobWidth(). 27 27 28 - width > 0 28 - width > 0 29 29 The diameter of the knob is fixed and the knob is aligned 30 according to the alignment() flags inside of the contentsRect(). 30 according to the alignment() flags inside of the contentsRect(). 31 31 32 32 - width <= 0 … … 36 36 Setting a fixed knobWidth() is helpful to align several knobs with different 37 37 scale labels. 38 38 39 39 \image html knob.png 40 40 */ … … 56 56 57 57 public: 58 /*! 58 /*! 59 59 \brief Style of the knob surface 60 60 … … 72 72 Raised, 73 73 74 /*! 74 /*! 75 75 Build a gradient from QPalette::Midlight, QPalette::Button 76 76 and QPalette::Midlight … … 78 78 Sunken, 79 79 80 /*! 80 /*! 81 81 Build a radial gradient from QPalette::Button 82 82 like it is used for QDial in various Qt styles. … … 87 87 /*! 88 88 \brief Marker type 89 89 90 90 The marker indicates the current value on the knob 91 91 The default setting is a Notch marker. … … 93 93 \sa setMarkerStyle(), setMarkerSize() 94 94 */ 95 enum MarkerStyle 96 { 95 enum MarkerStyle 96 { 97 97 //! Don't paint any marker 98 98 NoMarker = -1, 99 99 100 100 //! Paint a single tick in QPalette::ButtonText color 101 Tick, 101 Tick, 102 102 103 103 //! Paint a triangle in QPalette::ButtonText color 104 Triangle, 104 Triangle, 105 105 106 106 //! Paint a circle in QPalette::ButtonText color 107 Dot, 107 Dot, 108 108 109 /*! 109 /*! 110 110 Draw a raised ellipse with a gradient build from 111 111 QPalette::Light and QPalette::Mid 112 */ 113 Nub, 112 */ 113 Nub, 114 114 115 /*! 115 /*! 116 116 Draw a sunken ellipse with a gradient build from 117 117 QPalette::Light and QPalette::Mid 118 */ 119 Notch 118 */ 119 Notch 120 120 }; 121 121 … … 138 138 KnobStyle knobStyle() const; 139 139 140 void setBorderWidth( int bw);140 void setBorderWidth( int ); 141 141 int borderWidth() const; 142 142 … … 165 165 virtual void drawFocusIndicator( QPainter * ) const; 166 166 167 virtual void drawMarker( QPainter *, 168 const QRectF &, double a rc) const;167 virtual void drawMarker( QPainter *, 168 const QRectF &, double angle ) const; 169 169 170 170 virtual double scrolledTo( const QPoint & ) const; -
trunk/BNC/qwt/qwt_legend.cpp
r8127 r9383 50 50 }; 51 51 52 void QwtLegendMap::insert( const QVariant &itemInfo, 52 void QwtLegendMap::insert( const QVariant &itemInfo, 53 53 const QList<QWidget *> &widgets ) 54 54 { … … 142 142 { 143 143 public: 144 LegendView( QWidget *parent ):144 explicit LegendView( QWidget *parent ): 145 145 QScrollArea( parent ) 146 146 { … … 296 296 if ( tl ) 297 297 tl->setMaxColumns( numColums ); 298 299 updateGeometry(); 298 300 } 299 301 … … 342 344 343 345 /*! 344 The contents widget is the only child of the viewport of 346 The contents widget is the only child of the viewport of 345 347 the internal QScrollArea and the parent widget of all legend items. 346 348 … … 371 373 372 374 /*! 373 The contents widget is the only child of the viewport of 375 The contents widget is the only child of the viewport of 374 376 the internal QScrollArea and the parent widget of all legend items. 375 377 … … 386 388 387 389 \param itemInfo Info for an item 388 \param data List of legend entry attributes for the item390 \param legendData List of legend entry attributes for the item 389 391 */ 390 void QwtLegend::updateLegend( const QVariant &itemInfo, 391 const QList<QwtLegendData> & data )392 void QwtLegend::updateLegend( const QVariant &itemInfo, 393 const QList<QwtLegendData> &legendData ) 392 394 { 393 395 QList<QWidget *> widgetList = legendWidgets( itemInfo ); 394 396 395 if ( widgetList.size() != data.size() )397 if ( widgetList.size() != legendData.size() ) 396 398 { 397 399 QLayout *contentsLayout = d_data->view->contentsWidget->layout(); 398 400 399 while ( widgetList.size() > data.size() )401 while ( widgetList.size() > legendData.size() ) 400 402 { 401 403 QWidget *w = widgetList.takeLast(); … … 410 412 } 411 413 412 for ( int i = widgetList.size(); i < data.size(); i++ ) 413 { 414 QWidget *widget = createWidget( data[i] ); 414 #if QT_VERSION >= 0x040700 415 widgetList.reserve( legendData.size() ); 416 #endif 417 418 for ( int i = widgetList.size(); i < legendData.size(); i++ ) 419 { 420 QWidget *widget = createWidget( legendData[i] ); 415 421 416 422 if ( contentsLayout ) … … 441 447 updateTabOrder(); 442 448 } 443 444 for ( int i = 0; i < data.size(); i++ )445 updateWidget( widgetList[i], data[i] );449 450 for ( int i = 0; i < legendData.size(); i++ ) 451 updateWidget( widgetList[i], legendData[i] ); 446 452 } 447 453 … … 451 457 The default implementation returns a QwtLegendLabel. 452 458 453 \param data Attributes of the legend entry459 \param legendData Attributes of the legend entry 454 460 \return Widget representing data on the legend 455 461 456 462 \note updateWidget() will called soon after createWidget() 457 463 with the same attributes. 458 464 */ 459 QWidget *QwtLegend::createWidget( const QwtLegendData & data ) const460 { 461 Q_UNUSED( data );465 QWidget *QwtLegend::createWidget( const QwtLegendData &legendData ) const 466 { 467 Q_UNUSED( legendData ); 462 468 463 469 QwtLegendLabel *label = new QwtLegendLabel(); 464 470 label->setItemMode( defaultItemMode() ); 465 471 466 connect( label, SIGNAL( clicked() ), SLOT( itemClicked()) );467 connect( label, SIGNAL( checked( bool ) ), SLOT( itemChecked( bool )) );472 connect( label, SIGNAL(clicked()), SLOT(itemClicked()) ); 473 connect( label, SIGNAL(checked(bool)), SLOT(itemChecked(bool)) ); 468 474 469 475 return label; … … 471 477 472 478 /*! 473 \brief Update the widget 479 \brief Update the widget 474 480 475 481 \param widget Usually a QwtLegendLabel 476 \param data Attributes to be displayed482 \param legendData Attributes to be displayed 477 483 478 484 \sa createWidget() 479 485 \note When widget is no QwtLegendLabel updateWidget() does nothing. 480 486 */ 481 void QwtLegend::updateWidget( QWidget *widget, const QwtLegendData & data )487 void QwtLegend::updateWidget( QWidget *widget, const QwtLegendData &legendData ) 482 488 { 483 489 QwtLegendLabel *label = qobject_cast<QwtLegendLabel *>( widget ); 484 490 if ( label ) 485 491 { 486 label->setData( data );487 if ( ! data.value( QwtLegendData::ModeRole ).isValid() )492 label->setData( legendData ); 493 if ( !legendData.value( QwtLegendData::ModeRole ).isValid() ) 488 494 { 489 495 // use the default mode, when there is no specific … … 541 547 542 548 /*! 543 Handle QEvent::ChildRemoved andQEvent::LayoutRequest events 549 Handle QEvent::ChildRemoved andQEvent::LayoutRequest events 544 550 for the contentsWidget(). 545 551 … … 557 563 case QEvent::ChildRemoved: 558 564 { 559 const QChildEvent *ce = 565 const QChildEvent *ce = 560 566 static_cast<const QChildEvent *>(event); 567 561 568 if ( ce->child()->isWidgetType() ) 562 569 { 563 QWidget *w = static_cast< QWidget * >( ce->child() ); 570 /* 571 We are called from the ~QObject and ce->child() is 572 no widget anymore. But all we need is the address 573 to remove it from the map. 574 */ 575 QWidget *w = reinterpret_cast< QWidget * >( ce->child() ); 564 576 d_data->itemMap.removeWidget( w ); 565 577 } … … 585 597 QApplication::postEvent( parentWidget(), 586 598 new QEvent( QEvent::LayoutRequest ) ); 587 } 599 } 588 600 break; 589 601 } … … 645 657 \param painter Painter 646 658 \param rect Bounding rectangle 647 \param fillBackground When true, fill rect with the widget background 659 \param fillBackground When true, fill rect with the widget background 648 660 649 661 \sa renderLegend() is used by QwtPlotRenderer - not by QwtLegend itself 650 662 */ 651 void QwtLegend::renderLegend( QPainter *painter, 663 void QwtLegend::renderLegend( QPainter *painter, 652 664 const QRectF &rect, bool fillBackground ) const 653 665 { … … 664 676 } 665 677 666 const QwtDynGridLayout *legendLayout = 678 const QwtDynGridLayout *legendLayout = 667 679 qobject_cast<QwtDynGridLayout *>( contentsWidget()->layout() ); 668 680 if ( legendLayout == NULL ) … … 672 684 getContentsMargins( &left, &top, &right, &bottom ); 673 685 674 QRect layoutRect; 686 QRect layoutRect; 675 687 layoutRect.setLeft( qCeil( rect.left() ) + left ); 676 688 layoutRect.setTop( qCeil( rect.top() ) + top ); … … 679 691 680 692 uint numCols = legendLayout->columnsForWidth( layoutRect.width() ); 681 QList<QRect> itemRects =693 const QList<QRect> itemRects = 682 694 legendLayout->layoutItems( layoutRect, numCols ); 683 695 … … 707 719 \param widget Widget representing a legend entry 708 720 \param rect Bounding rectangle 709 \param fillBackground When true, fill rect with the widget background 721 \param fillBackground When true, fill rect with the widget background 710 722 711 723 \note When widget is not derived from QwtLegendLabel renderItem 712 724 does nothing beside the background 713 725 */ 714 void QwtLegend::renderItem( QPainter *painter, 726 void QwtLegend::renderItem( QPainter *painter, 715 727 const QWidget *widget, const QRectF &rect, bool fillBackground ) const 716 728 { … … 733 745 734 746 const QRectF iconRect( rect.x() + label->margin(), 735 rect.center().y() - 0.5 * sz.height(), 747 rect.center().y() - 0.5 * sz.height(), 736 748 sz.width(), sz.height() ); 737 749 … … 743 755 titleRect.setX( iconRect.right() + 2 * label->spacing() ); 744 756 745 painter->setFont( label->font() ); 757 QFont labelFont = label->font(); 758 labelFont.resolve( QFont::AllPropertiesResolved ); 759 760 painter->setFont( labelFont ); 746 761 painter->setPen( label->palette().color( QPalette::Text ) ); 762 747 763 const_cast< QwtLegendLabel *>( label )->drawText( painter, titleRect ); 748 764 } … … 795 811 Return the extent, that is needed for the scrollbars 796 812 797 \param orientation Orientation (813 \param orientation Orientation 798 814 \return The width of the vertical scrollbar for Qt::Horizontal and v.v. 799 815 */ -
trunk/BNC/qwt/qwt_legend.h
r8127 r9383 52 52 53 53 virtual QSize sizeHint() const; 54 virtual int heightForWidth( int w ) const;54 virtual int heightForWidth( int width ) const; 55 55 56 56 QScrollBar *horizontalScrollBar() const; 57 57 QScrollBar *verticalScrollBar() const; 58 58 59 virtual void renderLegend( QPainter *, 59 virtual void renderLegend( QPainter *, 60 60 const QRectF &, bool fillBackground ) const; 61 61 62 virtual void renderItem( QPainter *, 62 virtual void renderItem( QPainter *, 63 63 const QWidget *, const QRectF &, bool fillBackground ) const; 64 64 … … 106 106 protected: 107 107 virtual QWidget *createWidget( const QwtLegendData & ) const; 108 virtual void updateWidget( QWidget *widget, const QwtLegendData & data);108 virtual void updateWidget( QWidget *widget, const QwtLegendData & ); 109 109 110 110 private: … … 115 115 }; 116 116 117 #endif 117 #endif -
trunk/BNC/qwt/qwt_legend_data.cpp
r8127 r9383 124 124 return static_cast<QwtLegendData::Mode>( mode ); 125 125 } 126 126 127 127 return QwtLegendData::ReadOnly; 128 128 } -
trunk/BNC/qwt/qwt_legend_data.h
r8127 r9383 22 22 23 23 QwtLegendData is an abstract container ( like QAbstractModel ) 24 to exchange attributes, that are only known between to 25 the plot item and the legend. 26 24 to exchange attributes, that are only known between to 25 the plot item and the legend. 26 27 27 By overloading QwtPlotItem::legendData() any other set of attributes 28 could be used, that can be handled by a modified ( or completely 28 could be used, that can be handled by a modified ( or completely 29 29 different ) implementation of a legend. 30 30 … … 53 53 { 54 54 // The value is a Mode 55 ModeRole, 55 ModeRole, 56 56 57 57 // The value is a title 58 TitleRole, 58 TitleRole, 59 59 60 60 // The value is an icon 61 IconRole, 61 IconRole, 62 62 63 63 // Values < UserRole are reserved for internal use -
trunk/BNC/qwt/qwt_legend_label.cpp
r8127 r9383 140 140 d_data->isDown = false; 141 141 142 setFocusPolicy( ( mode != QwtLegendData::ReadOnly ) 142 setFocusPolicy( ( mode != QwtLegendData::ReadOnly ) 143 143 ? Qt::TabFocus : Qt::NoFocus ); 144 144 setMargin( ButtonFrame + Margin ); -
trunk/BNC/qwt/qwt_legend_label.h
r8127 r9383 78 78 }; 79 79 80 #endif 80 #endif -
trunk/BNC/qwt/qwt_magnifier.cpp
r8127 r9383 191 191 \sa getMouseButton() 192 192 */ 193 void QwtMagnifier::setMouseButton( 193 void QwtMagnifier::setMouseButton( 194 194 Qt::MouseButton button, Qt::KeyboardModifiers modifiers ) 195 195 { … … 239 239 \sa getZoomInKey(), setZoomOutKey() 240 240 */ 241 void QwtMagnifier::setZoomInKey( int key, 241 void QwtMagnifier::setZoomInKey( int key, 242 242 Qt::KeyboardModifiers modifiers ) 243 243 { … … 246 246 } 247 247 248 /*! 248 /*! 249 249 \brief Retrieve the settings of the zoom in key 250 250 … … 254 254 \sa setZoomInKey() 255 255 */ 256 void QwtMagnifier::getZoomInKey( int &key, 256 void QwtMagnifier::getZoomInKey( int &key, 257 257 Qt::KeyboardModifiers &modifiers ) const 258 258 { … … 269 269 \sa getZoomOutKey(), setZoomOutKey() 270 270 */ 271 void QwtMagnifier::setZoomOutKey( int key, 271 void QwtMagnifier::setZoomOutKey( int key, 272 272 Qt::KeyboardModifiers modifiers ) 273 273 { … … 276 276 } 277 277 278 /*! 278 /*! 279 279 \brief Retrieve the settings of the zoom out key 280 280 … … 284 284 \sa setZoomOutKey() 285 285 */ 286 void QwtMagnifier::getZoomOutKey( int &key, 286 void QwtMagnifier::getZoomOutKey( int &key, 287 287 Qt::KeyboardModifiers &modifiers ) const 288 288 { … … 438 438 of 120 (== 15 * 8). 439 439 */ 440 double f = qPow( d_data->wheelFactor, 440 double f = qPow( d_data->wheelFactor, 441 441 qAbs( wheelEvent->delta() / 120.0 ) ); 442 442 -
trunk/BNC/qwt/qwt_math.h
r8127 r9383 28 28 29 29 #ifndef M_PI_2 30 // For Qt <= 4.8.4 M_PI_2 is not known by MinGW-w64 30 // For Qt <= 4.8.4 M_PI_2 is not known by MinGW-w64 31 31 // when compiling with -std=c++11 32 32 #define M_PI_2 (1.57079632679489661923) -
trunk/BNC/qwt/qwt_matrix_raster_data.cpp
r8127 r9383 82 82 \param axis X, Y or Z axis 83 83 \param interval Interval 84 84 85 85 \sa QwtRasterData::interval(), setValueMatrix() 86 86 */ 87 void QwtMatrixRasterData::setInterval( 87 void QwtMatrixRasterData::setInterval( 88 88 Qt::Axis axis, const QwtInterval &interval ) 89 89 { … … 97 97 The positions of the values are calculated by dividing 98 98 the bounding rectangle of the X/Y intervals into equidistant 99 rectangles ( pixels ). Each value corresponds to the center of 99 rectangles ( pixels ). Each value corresponds to the center of 100 100 a pixel. 101 101 … … 105 105 \sa valueMatrix(), numColumns(), numRows(), setInterval()() 106 106 */ 107 void QwtMatrixRasterData::setValueMatrix( 107 void QwtMatrixRasterData::setValueMatrix( 108 108 const QVector<double> &values, int numColumns ) 109 109 { … … 162 162 \brief Calculate the pixel hint 163 163 164 pixelHint() returns the geometry of a pixel, that can be used 164 pixelHint() returns the geometry of a pixel, that can be used 165 165 to calculate the resolution and alignment of the plot item, that is 166 representing the data. 166 representing the data. 167 167 168 168 - NearestNeighbour\n 169 pixelHint() returns the surrounding pixel of the top left value 169 pixelHint() returns the surrounding pixel of the top left value 170 170 in the matrix. 171 171 172 172 - BilinearInterpolation\n 173 173 Returns an empty rectangle recommending 174 to render in target device ( f.e. screen ) resolution. 174 to render in target device ( f.e. screen ) resolution. 175 175 176 176 \param area Requested area, ignored … … 240 240 const double v22 = d_data->value( row2, col2 ); 241 241 242 const double x2 = xInterval.minValue() + 242 const double x2 = xInterval.minValue() + 243 243 ( col2 + 0.5 ) * d_data->dx; 244 const double y2 = yInterval.minValue() + 244 const double y2 = yInterval.minValue() + 245 245 ( row2 + 0.5 ) * d_data->dy; 246 246 247 247 const double rx = ( x2 - x ) / d_data->dx; 248 248 const double ry = ( y2 - y ) / d_data->dy; -
trunk/BNC/qwt/qwt_matrix_raster_data.h
r8127 r9383 19 19 20 20 QwtMatrixRasterData implements an interface for a matrix of 21 equidistant values, that can be used by a QwtPlotRasterItem. 21 equidistant values, that can be used by a QwtPlotRasterItem. 22 22 It implements a couple of resampling algorithms, to provide 23 23 values for positions, that or not on the value matrix. … … 39 39 40 40 /*! 41 Interpolate the value from the distances and values of the 41 Interpolate the value from the distances and values of the 42 42 4 surrounding values in the matrix, 43 43 */ -
trunk/BNC/qwt/qwt_null_paintdevice.cpp
r8127 r9383 10 10 #include "qwt_null_paintdevice.h" 11 11 #include <qpaintengine.h> 12 #include <qpainterpath.h> 12 13 #include <qpixmap.h> 13 14 … … 51 52 virtual void drawPolygon(const QPoint *, int , PolygonDrawMode ); 52 53 53 virtual void drawPixmap(const QRectF &, 54 virtual void drawPixmap(const QRectF &, 54 55 const QPixmap &, const QRectF &); 55 56 56 57 virtual void drawTextItem(const QPointF &, const QTextItem &); 57 58 58 virtual void drawTiledPixmap(const QRectF &, 59 virtual void drawTiledPixmap(const QRectF &, 59 60 const QPixmap &, const QPointF &s); 60 61 61 virtual void drawImage(const QRectF &, 62 virtual void drawImage(const QRectF &, 62 63 const QImage &, const QRectF &, Qt::ImageConversionFlags ); 63 64 … … 65 66 QwtNullPaintDevice *nullDevice(); 66 67 }; 67 68 68 69 QwtNullPaintDevice::PaintEngine::PaintEngine(): 69 70 QPaintEngine( QPaintEngine::AllFeatures ) … … 283 284 } 284 285 285 void QwtNullPaintDevice::PaintEngine::drawPixmap( 286 void QwtNullPaintDevice::PaintEngine::drawPixmap( 286 287 const QRectF &rect, const QPixmap &pm, const QRectF &subRect ) 287 288 { … … 310 311 311 312 void QwtNullPaintDevice::PaintEngine::drawTiledPixmap( 312 const QRectF &rect, const QPixmap &pixmap, 313 const QRectF &rect, const QPixmap &pixmap, 313 314 const QPointF &subRect) 314 315 { … … 321 322 QPaintEngine::drawTiledPixmap( rect, pixmap, subRect ); 322 323 return; 323 } 324 } 324 325 325 326 device->drawTiledPixmap( rect, pixmap, subRect ); … … 327 328 328 329 void QwtNullPaintDevice::PaintEngine::drawImage( 329 const QRectF &rect, const QImage &image, 330 const QRectF &rect, const QImage &image, 330 331 const QRectF &subRect, Qt::ImageConversionFlags flags) 331 332 { … … 338 339 339 340 void QwtNullPaintDevice::PaintEngine::updateState( 340 const QPaintEngineState & state)341 { 342 QwtNullPaintDevice *device = nullDevice(); 343 if ( device == NULL ) 344 return; 345 346 device->updateState( state );341 const QPaintEngineState &engineState) 342 { 343 QwtNullPaintDevice *device = nullDevice(); 344 if ( device == NULL ) 345 return; 346 347 device->updateState( engineState ); 347 348 } 348 349 … … 380 381 } 381 382 382 /*! 383 /*! 383 384 \return Render mode 384 385 \sa setMode() … … 394 395 if ( d_engine == NULL ) 395 396 { 396 QwtNullPaintDevice *that = 397 QwtNullPaintDevice *that = 397 398 const_cast< QwtNullPaintDevice * >( this ); 398 399 … … 403 404 } 404 405 405 /*! 406 /*! 406 407 See QPaintDevice::metric() 407 408 … … 415 416 int value; 416 417 417 switch ( deviceMetric ) 418 switch ( deviceMetric ) 418 419 { 419 420 case PdmWidth: … … 530 531 //! See QPaintEngine::drawPolygon() 531 532 void QwtNullPaintDevice::drawPolygon( 532 const QPointF *points, int pointCount, 533 const QPointF *points, int pointCount, 533 534 QPaintEngine::PolygonDrawMode mode) 534 535 { … … 540 541 //! See QPaintEngine::drawPolygon() 541 542 void QwtNullPaintDevice::drawPolygon( 542 const QPoint *points, int pointCount, 543 const QPoint *points, int pointCount, 543 544 QPaintEngine::PolygonDrawMode mode) 544 545 { … … 549 550 550 551 //! See QPaintEngine::drawPixmap() 551 void QwtNullPaintDevice::drawPixmap( const QRectF &rect, 552 void QwtNullPaintDevice::drawPixmap( const QRectF &rect, 552 553 const QPixmap &pm, const QRectF &subRect ) 553 554 { … … 567 568 //! See QPaintEngine::drawTiledPixmap() 568 569 void QwtNullPaintDevice::drawTiledPixmap( 569 const QRectF &rect, const QPixmap &pixmap, 570 const QRectF &rect, const QPixmap &pixmap, 570 571 const QPointF &subRect) 571 572 { … … 577 578 //! See QPaintEngine::drawImage() 578 579 void QwtNullPaintDevice::drawImage( 579 const QRectF &rect, const QImage &image, 580 const QRectF &rect, const QImage &image, 580 581 const QRectF &subRect, Qt::ImageConversionFlags flags) 581 582 { … … 587 588 588 589 //! See QPaintEngine::updateState() 589 void QwtNullPaintDevice::updateState( 590 void QwtNullPaintDevice::updateState( 590 591 const QPaintEngineState &state ) 591 592 { -
trunk/BNC/qwt/qwt_null_paintdevice.h
r8127 r9383 18 18 \brief A null paint device doing nothing 19 19 20 Sometimes important layout/rendering geometries are not 21 available or changeable from the public Qt class interface. 20 Sometimes important layout/rendering geometries are not 21 available or changeable from the public Qt class interface. 22 22 ( f.e hidden in the style implementation ). 23 23 24 QwtNullPaintDevice can be used to manipulate or filter out 24 QwtNullPaintDevice can be used to manipulate or filter out 25 25 this information by analyzing the stream of paint primitives. 26 26 … … 43 43 the corresponding draw methods 44 44 */ 45 NormalMode, 45 NormalMode, 46 46 47 47 /*! … … 77 77 virtual QPaintEngine *paintEngine() const; 78 78 79 virtual int metric( PaintDeviceMetric metric) const;79 virtual int metric( PaintDeviceMetric ) const; 80 80 81 81 virtual void drawRects(const QRect *, int ); … … 105 105 106 106 virtual void drawTiledPixmap(const QRectF &, 107 const QPixmap &, const QPointF & s);107 const QPixmap &, const QPointF & ); 108 108 109 109 virtual void drawImage(const QRectF &, 110 110 const QImage &, const QRectF &, Qt::ImageConversionFlags ); 111 111 112 virtual void updateState( const QPaintEngineState & state);112 virtual void updateState( const QPaintEngineState & ); 113 113 114 114 protected: -
trunk/BNC/qwt/qwt_painter.cpp
r8127 r9383 20 20 #include <qpalette.h> 21 21 #include <qpaintdevice.h> 22 #include <qpainterpath.h> 22 23 #include <qpixmap.h> 23 24 #include <qstyle.h> … … 33 34 #endif 34 35 35 #if QT_VERSION < 0x050000 36 #if QT_VERSION < 0x050000 36 37 37 38 #ifdef Q_WS_X11 … … 44 45 bool QwtPainter::d_roundingAlignment = true; 45 46 46 static inline bool qwtIsClippingNeeded( 47 static inline bool qwtIsClippingNeeded( 47 48 const QPainter *painter, QRectF &clipRect ) 48 49 { … … 142 143 bool QwtPainter::isX11GraphicsSystem() 143 144 { 145 /* 146 The X11 paint engine has been removed with Qt 5.0, but 147 reintroduced with Qt 5.10. It can be enabled with 148 "export QT_XCB_NATIVE_PAINTING=1". 149 */ 150 144 151 static int onX11 = -1; 145 152 if ( onX11 < 0 ) … … 181 188 } 182 189 183 const QTransform tr = painter->transform();190 const QTransform &tr = painter->transform(); 184 191 if ( tr.isRotating() || tr.isScaling() ) 185 192 { … … 196 203 to a paint engine that floors to integer values. For other paint engines 197 204 ( PDF, SVG ) this flag has no effect. 198 QwtPainter stores this flag only, the rounding itself is done in 205 QwtPainter stores this flag only, the rounding itself is done in 199 206 the painting code ( f.e the plot items ). 200 207 201 The default setting is true. 208 The default setting is true. 202 209 203 210 \sa roundingAlignment(), isAligning() … … 214 221 much faster when they are split in smaller chunks: f.e all supported Qt versions 215 222 >= Qt 5.0 when drawing an antialiased polyline with a pen width >=2. 223 224 Also the raster paint engine has a nasty bug in many versions ( Qt 4.8 - ... ) 225 for short lines ( https://codereview.qt-project.org/#/c/99456 ), that is worked 226 around in this mode. 216 227 217 228 The default setting is true. … … 397 408 unscaledRect = transform.inverted().mapRect(rect); 398 409 } 399 } 410 } 400 411 401 412 txt->setDefaultFont( painter->font() ); … … 452 463 QPolygonF cpa = polygon; 453 464 if ( deviceClipping ) 454 cpa = QwtClipper::clipPolygonF( clipRect, polygon );465 cpa = QwtClipper::clipPolygonF( clipRect, polygon, true ); 455 466 456 467 painter->drawPolygon( cpa ); … … 501 512 QPolygon cpa = polygon; 502 513 if ( deviceClipping ) 503 cpa = QwtClipper::clipPolygon( clipRect, polygon );514 cpa = QwtClipper::clipPolygon( clipRect, polygon, true ); 504 515 505 516 painter->drawPolygon( cpa ); … … 537 548 } 538 549 else 550 { 539 551 qwtDrawPolyline<QPoint>( painter, points, pointCount, d_polylineSplitting ); 552 } 540 553 } 541 554 … … 565 578 const int maxY = qFloor( clipRect.bottom() ); 566 579 567 if ( pos.x() < minX || pos.x() > maxX 580 if ( pos.x() < minX || pos.x() > maxX 568 581 || pos.y() < minY || pos.y() > maxY ) 569 582 { … … 576 589 577 590 //! Wrapper for QPainter::drawPoints() 578 void QwtPainter::drawPoints( QPainter *painter, 591 void QwtPainter::drawPoints( QPainter *painter, 579 592 const QPoint *points, int pointCount ) 580 593 { … … 609 622 610 623 //! Wrapper for QPainter::drawPoints() 611 void QwtPainter::drawPoints( QPainter *painter, 624 void QwtPainter::drawPoints( QPainter *painter, 612 625 const QPointF *points, int pointCount ) 613 626 { … … 697 710 698 711 /*! 699 Draw a round frame 712 Draw a round frame 700 713 701 714 \param painter Painter … … 708 721 */ 709 722 void QwtPainter::drawRoundFrame( QPainter *painter, 710 const QRectF &rect, const QPalette &palette, 723 const QRectF &rect, const QPalette &palette, 711 724 int lineWidth, int frameStyle ) 712 725 { … … 787 800 { 788 801 const QRectF outerRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 ); 789 const QRectF innerRect = outerRect.adjusted( 802 const QRectF innerRect = outerRect.adjusted( 790 803 frameWidth, frameWidth, -frameWidth, -frameWidth ); 791 804 … … 806 819 { 807 820 const QRectF outerRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 ); 808 const QRectF midRect1 = outerRect.adjusted( 821 const QRectF midRect1 = outerRect.adjusted( 809 822 frameWidth, frameWidth, -frameWidth, -frameWidth ); 810 const QRectF midRect2 = midRect1.adjusted( 823 const QRectF midRect2 = midRect1.adjusted( 811 824 midLineWidth, midLineWidth, -midLineWidth, -midLineWidth ); 812 825 813 const QRectF innerRect = midRect2.adjusted( 826 const QRectF innerRect = midRect2.adjusted( 814 827 frameWidth, frameWidth, -frameWidth, -frameWidth ); 815 828 … … 887 900 { 888 901 const QRectF outerRect = rect.adjusted( 0.0, 0.0, -1.0, -1.0 ); 889 const QRectF innerRect = outerRect.adjusted( 890 frameWidth - 1.0, frameWidth - 1.0, 902 const QRectF innerRect = outerRect.adjusted( 903 frameWidth - 1.0, frameWidth - 1.0, 891 904 -( frameWidth - 1.0 ), -( frameWidth - 1.0 ) ); 892 905 … … 942 955 */ 943 956 944 void QwtPainter::drawRoundedFrame( QPainter *painter, 945 const QRectF &rect, double xRadius, double yRadius, 957 void QwtPainter::drawRoundedFrame( QPainter *painter, 958 const QRectF &rect, double xRadius, double yRadius, 946 959 const QPalette &palette, int lineWidth, int frameStyle ) 947 960 { … … 951 964 952 965 double lw2 = lineWidth * 0.5; 953 QRectF r= rect.adjusted( lw2, lw2, -lw2, -lw2 );966 QRectF innerRect = rect.adjusted( lw2, lw2, -lw2, -lw2 ); 954 967 955 968 QPainterPath path; 956 path.addRoundedRect( r, xRadius, yRadius );969 path.addRoundedRect( innerRect, xRadius, yRadius ); 957 970 958 971 enum Style … … 973 986 // move + 4 * ( cubicTo + lineTo ) 974 987 QPainterPath pathList[8]; 975 988 976 989 for ( int i = 0; i < 4; i++ ) 977 990 { 978 991 const int j = i * 4 + 1; 979 992 980 993 pathList[ 2 * i ].moveTo( 981 994 path.elementAt(j - 1).x, path.elementAt( j - 1 ).y 982 ); 983 995 ); 996 984 997 pathList[ 2 * i ].cubicTo( 985 998 path.elementAt(j + 0).x, path.elementAt(j + 0).y, 986 999 path.elementAt(j + 1).x, path.elementAt(j + 1).y, 987 1000 path.elementAt(j + 2).x, path.elementAt(j + 2).y ); 988 1001 989 1002 pathList[ 2 * i + 1 ].moveTo( 990 1003 path.elementAt(j + 2).x, path.elementAt(j + 2).y 991 ); 1004 ); 992 1005 pathList[ 2 * i + 1 ].lineTo( 993 1006 path.elementAt(j + 3).x, path.elementAt(j + 3).y 994 ); 995 } 1007 ); 1008 } 996 1009 997 1010 QColor c1( palette.color( QPalette::Dark ) ); … … 1003 1016 for ( int i = 0; i < 4; i++ ) 1004 1017 { 1005 QRectF r = pathList[2 * i].controlPointRect();1018 const QRectF r = pathList[2 * i].controlPointRect(); 1006 1019 1007 1020 QPen arcPen; … … 1147 1160 } 1148 1161 1149 static inline void qwtFillRect( const QWidget *widget, QPainter *painter, 1162 static inline void qwtFillRect( const QWidget *widget, QPainter *painter, 1150 1163 const QRect &rect, const QBrush &brush) 1151 1164 { 1152 if ( brush.style() == Qt::TexturePattern ) 1165 if ( brush.style() == Qt::TexturePattern ) 1153 1166 { 1154 1167 painter->save(); … … 1158 1171 1159 1172 painter->restore(); 1160 } 1173 } 1161 1174 else if ( brush.gradient() ) 1162 1175 { … … 1164 1177 1165 1178 painter->setClipRect( rect ); 1166 painter->fillRect(0, 0, widget->width(), 1179 painter->fillRect(0, 0, widget->width(), 1167 1180 widget->height(), brush); 1168 1181 1169 1182 painter->restore(); 1170 } 1171 else 1183 } 1184 else 1172 1185 { 1173 1186 painter->fillRect(rect, brush); … … 1179 1192 1180 1193 In Qt >= 5.0 QPixmap::fill() is a nop, in Qt 4.x it is buggy 1181 for backgrounds with gradients. Thus fillPixmap() offers 1194 for backgrounds with gradients. Thus fillPixmap() offers 1182 1195 an alternative implementation. 1183 1196 1184 1197 \param widget Widget 1185 1198 \param pixmap Pixmap to be filled 1186 \param offset Offset 1199 \param offset Offset 1187 1200 1188 1201 \sa QPixmap::fill() 1189 1202 */ 1190 void QwtPainter::fillPixmap( const QWidget *widget, 1203 void QwtPainter::fillPixmap( const QWidget *widget, 1191 1204 QPixmap &pixmap, const QPoint &offset ) 1192 1205 { … … 1196 1209 painter.translate( -offset ); 1197 1210 1198 const QBrush autoFillBrush = 1211 const QBrush autoFillBrush = 1199 1212 widget->palette().brush( widget->backgroundRole() ); 1200 1213 1201 if ( !( widget->autoFillBackground() && autoFillBrush.isOpaque() ) ) 1214 if ( !( widget->autoFillBackground() && autoFillBrush.isOpaque() ) ) 1202 1215 { 1203 1216 const QBrush bg = widget->palette().brush( QPalette::Window ); … … 1208 1221 qwtFillRect( widget, &painter, rect, autoFillBrush); 1209 1222 1210 if ( widget->testAttribute(Qt::WA_StyledBackground) ) 1223 if ( widget->testAttribute(Qt::WA_StyledBackground) ) 1211 1224 { 1212 1225 painter.setClipRegion( rect ); … … 1214 1227 QStyleOption opt; 1215 1228 opt.initFrom( widget ); 1216 widget->style()->drawPrimitive( QStyle::PE_Widget, 1229 widget->style()->drawPrimitive( QStyle::PE_Widget, 1217 1230 &opt, &painter, widget ); 1218 1231 } … … 1285 1298 #endif 1286 1299 1287 #if QT_VERSION < 0x050000 1300 #if QT_VERSION < 0x050000 1288 1301 #ifdef Q_WS_X11 1289 1302 if ( widget && isX11GraphicsSystem() ) -
trunk/BNC/qwt/qwt_painter.h
r8127 r9383 51 51 static void drawText( QPainter *, double x, double y, double w, double h, 52 52 int flags, const QString & ); 53 static void drawText( QPainter *, const QRectF &, 53 static void drawText( QPainter *, const QRectF &, 54 54 int flags, const QString & ); 55 55 … … 64 64 65 65 static void drawEllipse( QPainter *, const QRectF & ); 66 static void drawPie( QPainter *, const QRectF & r, int a, int alen );66 static void drawPie( QPainter *, const QRectF &, int a, int alen ); 67 67 68 68 static void drawLine( QPainter *, double x1, double y1, double x2, double y2 ); … … 94 94 const QRectF &, const QPalette &, int lineWidth, int frameStyle ); 95 95 96 static void drawRoundedFrame( QPainter *, 96 static void drawRoundedFrame( QPainter *, 97 97 const QRectF &, double xRadius, double yRadius, 98 98 const QPalette &, int lineWidth, int frameStyle ); … … 100 100 static void drawFrame( QPainter *, const QRectF &rect, 101 101 const QPalette &palette, QPalette::ColorRole foregroundRole, 102 int lineWidth, int midLineWidth, int frameStyle );102 int frameWidth, int midLineWidth, int frameStyle ); 103 103 104 104 static void drawFocusRect( QPainter *, const QWidget * ); … … 112 112 static bool isX11GraphicsSystem(); 113 113 114 static void fillPixmap( const QWidget *, 114 static void fillPixmap( const QWidget *, 115 115 QPixmap &, const QPoint &offset = QPoint() ); 116 116 -
trunk/BNC/qwt/qwt_painter_command.cpp
r8127 r9383 64 64 } 65 65 66 /*! 66 /*! 67 67 Constructor for State paint operation 68 68 \param state Paint engine state 69 */ 69 */ 70 70 QwtPainterCommand::QwtPainterCommand( const QPaintEngineState &state ): 71 71 d_type( State ) … … 75 75 d_stateData->flags = state.state(); 76 76 77 if ( d_stateData->flags & QPaintEngine::DirtyPen ) 77 if ( d_stateData->flags & QPaintEngine::DirtyPen ) 78 78 d_stateData->pen = state.pen(); 79 79 80 if ( d_stateData->flags & QPaintEngine::DirtyBrush ) 80 if ( d_stateData->flags & QPaintEngine::DirtyBrush ) 81 81 d_stateData->brush = state.brush(); 82 82 83 if ( d_stateData->flags & QPaintEngine::DirtyBrushOrigin ) 83 if ( d_stateData->flags & QPaintEngine::DirtyBrushOrigin ) 84 84 d_stateData->brushOrigin = state.brushOrigin(); 85 85 86 if ( d_stateData->flags & QPaintEngine::DirtyFont ) 86 if ( d_stateData->flags & QPaintEngine::DirtyFont ) 87 87 d_stateData->font = state.font(); 88 88 89 if ( d_stateData->flags & QPaintEngine::DirtyBackground ) 89 if ( d_stateData->flags & QPaintEngine::DirtyBackground ) 90 90 { 91 91 d_stateData->backgroundMode = state.backgroundMode(); … … 93 93 } 94 94 95 if ( d_stateData->flags & QPaintEngine::DirtyTransform ) 95 if ( d_stateData->flags & QPaintEngine::DirtyTransform ) 96 96 d_stateData->transform = state.transform(); 97 97 98 if ( d_stateData->flags & QPaintEngine::DirtyClipEnabled ) 98 if ( d_stateData->flags & QPaintEngine::DirtyClipEnabled ) 99 99 d_stateData->isClipEnabled = state.isClipEnabled(); 100 100 101 if ( d_stateData->flags & QPaintEngine::DirtyClipRegion ) 101 if ( d_stateData->flags & QPaintEngine::DirtyClipRegion ) 102 102 { 103 103 d_stateData->clipRegion = state.clipRegion(); … … 105 105 } 106 106 107 if ( d_stateData->flags & QPaintEngine::DirtyClipPath ) 107 if ( d_stateData->flags & QPaintEngine::DirtyClipPath ) 108 108 { 109 109 d_stateData->clipPath = state.clipPath(); … … 111 111 } 112 112 113 if ( d_stateData->flags & QPaintEngine::DirtyHints ) 113 if ( d_stateData->flags & QPaintEngine::DirtyHints ) 114 114 d_stateData->renderHints = state.renderHints(); 115 115 116 if ( d_stateData->flags & QPaintEngine::DirtyCompositionMode ) 116 if ( d_stateData->flags & QPaintEngine::DirtyCompositionMode ) 117 117 d_stateData->compositionMode = state.compositionMode(); 118 118 119 if ( d_stateData->flags & QPaintEngine::DirtyOpacity ) 119 if ( d_stateData->flags & QPaintEngine::DirtyOpacity ) 120 120 d_stateData->opacity = state.opacity(); 121 121 } … … 124 124 Copy constructor 125 125 \param other Command to be copied 126 126 127 127 */ 128 128 QwtPainterCommand::QwtPainterCommand(const QwtPainterCommand &other) … … 214 214 215 215 //! \return Painter path to be painted 216 QPainterPath *QwtPainterCommand::path() 216 QPainterPath *QwtPainterCommand::path() 217 217 { 218 218 return d_path; … … 220 220 221 221 //! \return Attributes how to paint a QPixmap 222 QwtPainterCommand::PixmapData* QwtPainterCommand::pixmapData() 222 QwtPainterCommand::PixmapData* QwtPainterCommand::pixmapData() 223 223 { 224 224 return d_pixmapData; … … 226 226 227 227 //! \return Attributes how to paint a QImage 228 QwtPainterCommand::ImageData* QwtPainterCommand::imageData() 228 QwtPainterCommand::ImageData* QwtPainterCommand::imageData() 229 229 { 230 230 return d_imageData; … … 232 232 233 233 //! \return Attributes of a state change 234 QwtPainterCommand::StateData* QwtPainterCommand::stateData() 234 QwtPainterCommand::StateData* QwtPainterCommand::stateData() 235 235 { 236 236 return d_stateData; -
trunk/BNC/qwt/qwt_painter_command.h
r8127 r9383 16 16 #include <qimage.h> 17 17 #include <qpolygon.h> 18 #include <qpainterpath.h> 18 19 19 20 class QPainterPath; … … 27 28 \sa QwtGraphic::commands() 28 29 */ 29 30 30 31 class QWT_EXPORT QwtPainterCommand 31 32 { … … 50 51 }; 51 52 52 //! Attributes how to paint a QPixmap 53 //! Attributes how to paint a QPixmap 53 54 struct PixmapData 54 55 { … … 58 59 }; 59 60 60 //! Attributes how to paint a QImage 61 //! Attributes how to paint a QImage 61 62 struct ImageData 62 63 { … … 151 152 152 153 //! \return Attributes how to paint a QPixmap 153 inline const QwtPainterCommand::PixmapData *154 inline const QwtPainterCommand::PixmapData * 154 155 QwtPainterCommand::pixmapData() const 155 156 { … … 158 159 159 160 //! \return Attributes how to paint a QImage 160 inline const QwtPainterCommand::ImageData * 161 inline const QwtPainterCommand::ImageData * 161 162 QwtPainterCommand::imageData() const 162 163 { … … 165 166 166 167 //! \return Attributes of a state change 167 inline const QwtPainterCommand::StateData * 168 inline const QwtPainterCommand::StateData * 168 169 QwtPainterCommand::stateData() const 169 170 { -
trunk/BNC/qwt/qwt_panner.cpp
r8127 r9383 129 129 \param modifiers Keyboard modifiers 130 130 */ 131 void QwtPanner::setAbortKey( int key, 131 void QwtPanner::setAbortKey( int key, 132 132 Qt::KeyboardModifiers modifiers ) 133 133 { … … 137 137 138 138 //! Get the abort key and modifiers 139 void QwtPanner::getAbortKey( int &key, 139 void QwtPanner::getAbortKey( int &key, 140 140 Qt::KeyboardModifiers &modifiers ) const 141 141 { … … 248 248 fill the empty spaces by the background of the parent widget. 249 249 250 \param pePaint event251 */ 252 void QwtPanner::paintEvent( QPaintEvent * pe)250 \param event Paint event 251 */ 252 void QwtPanner::paintEvent( QPaintEvent *event ) 253 253 { 254 254 int dx = d_data->pos.x() - d_data->initialPos.x(); 255 255 int dy = d_data->pos.y() - d_data->initialPos.y(); 256 256 257 QRect r( 0, 0, d_data->pixmap.width(), d_data->pixmap.height() ); 258 r.moveCenter( QPoint( r.center().x() + dx, r.center().y() + dy ) ); 259 260 QPixmap pm( size() ); 257 QRectF r; 258 r.setSize( d_data->pixmap.size() ); 259 #if QT_VERSION >= 0x050000 260 r.setSize( r.size() / d_data->pixmap.devicePixelRatio() ); 261 #endif 262 r.moveCenter( QPointF( r.center().x() + dx, r.center().y() + dy ) ); 263 264 QPixmap pm = QwtPainter::backingStore( this, size() ); 261 265 QwtPainter::fillPixmap( parentWidget(), pm ); 262 266 … … 267 271 QPixmap masked = d_data->pixmap; 268 272 masked.setMask( d_data->contentsMask ); 269 painter.drawPixmap( r , masked );273 painter.drawPixmap( r.toRect(), masked ); 270 274 } 271 275 else 272 276 { 273 painter.drawPixmap( r , d_data->pixmap );277 painter.drawPixmap( r.toRect(), d_data->pixmap ); 274 278 } 275 279 … … 280 284 281 285 painter.begin( this ); 282 painter.setClipRegion( pe->region() );286 painter.setClipRegion( event->region() ); 283 287 painter.drawPixmap( 0, 0, pm ); 284 288 } -
trunk/BNC/qwt/qwt_panner.h
r8127 r9383 44 44 bool isEnabled() const; 45 45 46 void setMouseButton( Qt::MouseButton, 46 void setMouseButton( Qt::MouseButton, 47 47 Qt::KeyboardModifiers = Qt::NoModifier ); 48 void getMouseButton( Qt::MouseButton &button, 48 void getMouseButton( Qt::MouseButton &button, 49 49 Qt::KeyboardModifiers & ) const; 50 50 -
trunk/BNC/qwt/qwt_picker.cpp
r8127 r9383 53 53 if ( l.x1() == l.x2() ) 54 54 { 55 region += QRect( l.x1() - pw2, l.y1(), 55 region += QRect( l.x1() - pw2, l.y1(), 56 56 pw, l.y2() ).normalized(); 57 57 } 58 58 else if ( l.y1() == l.y2() ) 59 59 { 60 region += QRect( l.x1(), l.y1() - pw2, 60 region += QRect( l.x1(), l.y1() - pw2, 61 61 l.x2(), pw ).normalized(); 62 62 } … … 78 78 79 79 class QwtPickerTracker: public QwtWidgetOverlay 80 { 80 { 81 81 public: 82 82 QwtPickerTracker( QwtPicker *, QWidget * ); 83 83 84 84 protected: 85 85 virtual void drawOverlay( QPainter * ) const; 86 86 virtual QRegion maskHint() const; 87 87 88 88 QwtPicker *d_picker; 89 }; 89 }; 90 90 91 91 … … 105 105 { 106 106 } 107 107 108 108 bool enabled; 109 109 … … 558 558 case VLineRubberBand: 559 559 { 560 mask += qwtMaskRegion( QLine( pos.x(), pRect.top(), 560 mask += qwtMaskRegion( QLine( pos.x(), pRect.top(), 561 561 pos.x(), pRect.bottom() ), pw ); 562 562 break; … … 564 564 case HLineRubberBand: 565 565 { 566 mask += qwtMaskRegion( QLine( pRect.left(), pos.y(), 566 mask += qwtMaskRegion( QLine( pRect.left(), pos.y(), 567 567 pRect.right(), pos.y() ), pw ); 568 568 break; … … 570 570 case CrossRubberBand: 571 571 { 572 mask += qwtMaskRegion( QLine( pos.x(), pRect.top(), 572 mask += qwtMaskRegion( QLine( pos.x(), pRect.top(), 573 573 pos.x(), pRect.bottom() ), pw ); 574 mask += qwtMaskRegion( QLine( pRect.left(), pos.y(), 574 mask += qwtMaskRegion( QLine( pRect.left(), pos.y(), 575 575 pRect.right(), pos.y() ), pw ); 576 576 break; … … 752 752 depends on the application requirements. F.e. : 753 753 754 - A rectangular selection might need to have a specific aspect ratio only.\n755 - A selection could accept non intersecting polygons only.\n756 - ...\n754 - A rectangular selection might need to have a specific aspect ratio only. 755 - A selection could accept non intersecting polygons only. 756 - ... 757 757 758 758 The example below is for a rectangular selection, where the first 759 759 point is the center of the selected rectangle. 760 760 761 \par Example 761 \verbatim QPolygon MyPicker::adjustedPoints(const QPolygon &points) const 762 { 763 QPolygon adjusted; 764 if ( points.size() == 2 ) 765 { 766 const int width = qAbs(points[1].x() - points[0].x()); 767 const int height = qAbs(points[1].y() - points[0].y()); 768 769 QRect rect(0, 0, 2 * width, 2 * height); 770 rect.moveCenter(points[0]); 771 772 adjusted += rect.topLeft(); 773 adjusted += rect.bottomRight(); 774 } 775 return adjusted; 776 }\endverbatim\n 762 \code 763 QPolygon MyPicker::adjustedPoints( const QPolygon &points ) const 764 { 765 QPolygon adjusted; 766 if ( points.size() == 2 ) 767 { 768 const int width = qAbs( points[1].x() - points[0].x() ); 769 const int height = qAbs( points[1].y() - points[0].y() ); 770 771 QRect rect( 0, 0, 2 * width, 2 * height ); 772 rect.moveCenter( points[0] ); 773 774 adjusted += rect.topLeft(); 775 adjusted += rect.bottomRight(); 776 } 777 return adjusted; 778 } 779 \endcode 780 \endpar 777 781 778 782 \param points Selected points … … 833 837 { 834 838 const QPoint last = 835 d_data->pickedPoints[ int( d_data->pickedPoints.count() ) - 2];839 d_data->pickedPoints[ d_data->pickedPoints.count() - 2 ]; 836 840 837 841 alignment |= ( pos.x() >= last.x() ) ? Qt::AlignRight : Qt::AlignLeft; … … 1183 1187 case QEvent::MouseMove: 1184 1188 { 1185 const QMouseEvent *me = 1189 const QMouseEvent *me = 1186 1190 static_cast< const QMouseEvent * >( event ); 1187 1191 pos = me->pos(); … … 1235 1239 return; 1236 1240 1237 d_data->pickedPoints. resize( 0);1241 d_data->pickedPoints.clear(); 1238 1242 d_data->isActive = true; 1239 1243 Q_EMIT activated( true ); … … 1281 1285 Q_EMIT selected( d_data->pickedPoints ); 1282 1286 else 1283 d_data->pickedPoints. resize( 0);1287 d_data->pickedPoints.clear(); 1284 1288 1285 1289 updateDisplay(); … … 1315 1319 if ( d_data->isActive ) 1316 1320 { 1317 const int idx = d_data->pickedPoints.count(); 1318 d_data->pickedPoints.resize( idx + 1 ); 1319 d_data->pickedPoints[idx] = pos; 1321 d_data->pickedPoints += pos; 1320 1322 1321 1323 updateDisplay(); … … 1333 1335 void QwtPicker::move( const QPoint &pos ) 1334 1336 { 1335 if ( d_data->isActive ) 1336 { 1337 const int idx = d_data->pickedPoints.count() - 1; 1338 if ( idx >= 0 ) 1339 { 1340 if ( d_data->pickedPoints[idx] != pos ) 1341 { 1342 d_data->pickedPoints[idx] = pos; 1343 1344 updateDisplay(); 1345 Q_EMIT moved( pos ); 1346 } 1337 if ( d_data->isActive && !d_data->pickedPoints.isEmpty() ) 1338 { 1339 QPoint &point = d_data->pickedPoints.last(); 1340 if ( point != pos ) 1341 { 1342 point = pos; 1343 1344 updateDisplay(); 1345 Q_EMIT moved( pos ); 1347 1346 } 1348 1347 } … … 1357 1356 void QwtPicker::remove() 1358 1357 { 1359 if ( d_data->isActive ) 1360 { 1361 const int idx = d_data->pickedPoints.count() - 1; 1362 if ( idx > 0 ) 1363 { 1364 const int idx = d_data->pickedPoints.count(); 1365 1366 const QPoint pos = d_data->pickedPoints[idx - 1]; 1367 d_data->pickedPoints.resize( idx - 1 ); 1368 1369 updateDisplay(); 1370 Q_EMIT removed( pos ); 1371 } 1358 if ( d_data->isActive && !d_data->pickedPoints.isEmpty() ) 1359 { 1360 #if QT_VERSION >= 0x050100 1361 const QPoint pos = d_data->pickedPoints.takeLast(); 1362 #else 1363 const QPoint pos = d_data->pickedPoints.last(); 1364 d_data->pickedPoints.resize( d_data->pickedPoints.count() - 1 ); 1365 #endif 1366 1367 updateDisplay(); 1368 Q_EMIT removed( pos ); 1372 1369 } 1373 1370 } … … 1424 1421 } 1425 1422 1426 const double xRatio = 1427 double( newSize.width() ) / double( oldSize.width() ); 1428 const double yRatio = 1429 double( newSize.height() ) / double( oldSize.height() ); 1430 1431 for ( int i = 0; i < int( d_data->pickedPoints.count() ); i++ ) 1423 const double xRatio = double( newSize.width() ) / double( oldSize.width() ); 1424 const double yRatio = double( newSize.height() ) / double( oldSize.height() ); 1425 1426 for ( int i = 0; i < d_data->pickedPoints.count(); i++ ) 1432 1427 { 1433 1428 QPoint &p = d_data->pickedPoints[i]; … … 1472 1467 Find the area of the observed widget, where selection might happen. 1473 1468 1474 \return parentWidget()->contentsRect() 1469 \return parentWidget()->contentsRect() 1475 1470 */ 1476 1471 QPainterPath QwtPicker::pickArea() const … … 1504 1499 ( trackerMode() == ActiveOnly && isActive() ) ) 1505 1500 { 1506 if ( trackerPen() != Qt::NoPen 1501 if ( trackerPen() != Qt::NoPen 1507 1502 && !trackerRect( QFont() ).isEmpty() ) 1508 1503 { -
trunk/BNC/qwt/qwt_picker.h
r8127 r9383 59 59 60 60 \par Example 61 \verbatim #include <qwt_picker.h> 62 #include <qwt_picker_machine.h> 63 64 QwtPicker *picker = new QwtPicker(widget); 65 picker->setStateMachine(new QwtPickerDragRectMachine); 66 picker->setTrackerMode(QwtPicker::ActiveOnly); 67 picker->setRubberBand(QwtPicker::RectRubberBand); \endverbatim\n 61 \code 62 #include <qwt_picker.h> 63 #include <qwt_picker_machine.h> 64 65 QwtPicker *picker = new QwtPicker(widget); 66 picker->setStateMachine(new QwtPickerDragRectMachine); 67 picker->setTrackerMode(QwtPicker::ActiveOnly); 68 picker->setRubberBand(QwtPicker::RectRubberBand); 69 \endcode 70 \endpar 68 71 69 72 The state machine triggers the following commands: … … 308 311 virtual void widgetLeaveEvent( QEvent * ); 309 312 310 virtual void stretchSelection( const QSize &oldSize,311 313 virtual void stretchSelection( 314 const QSize &oldSize, const QSize &newSize ); 312 315 313 316 virtual void updateDisplay(); -
trunk/BNC/qwt/qwt_picker_machine.cpp
r8127 r9383 106 106 case QEvent::MouseButtonPress: 107 107 { 108 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 108 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 109 109 static_cast<const QMouseEvent *>( event ) ) ) 110 110 { … … 152 152 case QEvent::MouseButtonPress: 153 153 { 154 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 154 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 155 155 static_cast<const QMouseEvent *>( event ) ) ) 156 156 { … … 225 225 case QEvent::MouseButtonPress: 226 226 { 227 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 227 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 228 228 static_cast<const QMouseEvent *>( event ) ) ) 229 229 { … … 260 260 case QEvent::MouseButtonRelease: 261 261 { 262 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 262 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 263 263 static_cast<const QMouseEvent *>( event ) ) ) 264 264 { … … 324 324 case QEvent::MouseButtonPress: 325 325 { 326 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 326 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 327 327 static_cast<const QMouseEvent *>( event ) ) ) 328 328 { … … 355 355 case QEvent::KeyPress: 356 356 { 357 if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, 357 if ( eventPattern.keyMatch( QwtEventPattern::KeySelect1, 358 358 static_cast<const QKeyEvent *> ( event ) ) ) 359 359 { … … 396 396 case QEvent::MouseButtonPress: 397 397 { 398 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 398 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect1, 399 399 static_cast<const QMouseEvent *>( event ) ) ) 400 400 { … … 411 411 } 412 412 } 413 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect2, 413 if ( eventPattern.mouseMatch( QwtEventPattern::MouseSelect2, 414 414 static_cast<const QMouseEvent *>( event ) ) ) 415 415 { -
trunk/BNC/qwt/qwt_picker_machine.h
r8127 r9383 170 170 /*! 171 171 \brief A state machine for line selections 172 172 173 173 Pressing QwtEventPattern::MouseSelect1 selects 174 174 the first point, releasing it the second point. … … 179 179 A common use case of QwtPickerDragLineMachine are pickers for 180 180 distance measurements. 181 182 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode 183 */ 184 181 182 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode 183 */ 184 185 185 class QWT_EXPORT QwtPickerDragLineMachine: public QwtPickerMachine 186 186 { -
trunk/BNC/qwt/qwt_plot.cpp
r8127 r9383 28 28 if ( on ) 29 29 { 30 QObject::connect( 31 plot, SIGNAL( legendDataChanged( 32 const QVariant &, const QList<QwtLegendData> & ) ), 33 plot, SLOT( updateLegendItems( 34 const QVariant &, const QList<QwtLegendData> & ) ) ); 30 QObject::connect( 31 plot, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)), 32 plot, SLOT(updateLegendItems(QVariant,QList<QwtLegendData>)) 33 ); 35 34 } 36 35 else 37 36 { 38 QObject::disconnect( 39 plot, SIGNAL( legendDataChanged( 40 const QVariant &, const QList<QwtLegendData> & ) ), 41 plot, SLOT( updateLegendItems( 42 const QVariant &, const QList<QwtLegendData> & ) ) ); 43 } 44 } 45 46 static void qwtSetTabOrder( 37 QObject::disconnect( 38 plot, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>) ), 39 plot, SLOT( updateLegendItems(QVariant,QList<QwtLegendData>)) 40 ); 41 } 42 } 43 44 static void qwtSetTabOrder( 47 45 QWidget *first, QWidget *second, bool withChildren ) 48 46 { … … 196 194 QwtPlot invokes methods of the canvas as meta methods ( see QMetaObject ). 197 195 In opposite to using conventional C++ techniques like virtual methods 198 they allow to use canvas implementations that are derived from 196 they allow to use canvas implementations that are derived from 199 197 QWidget or QGLWidget. 200 198 … … 210 208 it is o.k. not to implement this method. 211 209 212 The default canvas is a QwtPlotCanvas 210 The default canvas is a QwtPlotCanvas 213 211 214 212 \param canvas Canvas Widget … … 317 315 } 318 316 319 /*! 317 /*! 320 318 \return true if the autoReplot option is set. 321 319 \sa setAutoReplot() … … 371 369 372 370 /*! 373 Change the text the footer 371 Change the text the footer 374 372 \param text New text of the footer 375 373 */ … … 384 382 385 383 /*! 386 Change the text the footer 384 Change the text the footer 387 385 \param text New text of the footer 388 386 */ … … 560 558 if ( d_data->canvas ) 561 559 { 562 const bool ok = QMetaObject::invokeMethod( 560 const bool ok = QMetaObject::invokeMethod( 563 561 d_data->canvas, "replot", Qt::DirectConnection ); 564 562 if ( !ok ) … … 724 722 getCanvasMarginsHint( maps, canvas()->contentsRect(), 725 723 margins[yLeft], margins[xTop], margins[yRight], margins[xBottom] ); 726 724 727 725 bool doUpdate = false; 728 726 for ( int axisId = 0; axisId < axisCnt; axisId++ ) … … 766 764 767 765 \note Usually canvasRect is contentsRect() of the plot canvas. 768 Due to a bug in Qt this rectangle might be wrong for certain 769 frame styles ( f.e QFrame::Box ) and it might be necessary to 766 Due to a bug in Qt this rectangle might be wrong for certain 767 frame styles ( f.e QFrame::Box ) and it might be necessary to 770 768 fix the margins manually using QWidget::setContentsMargins() 771 769 */ … … 914 912 915 913 insertLegend() will set the plot widget as parent for the legend. 916 The legend will be deleted in the destructor of the plot or when 914 The legend will be deleted in the destructor of the plot or when 917 915 another legend is inserted. 918 916 … … 952 950 if ( d_data->legend ) 953 951 { 954 connect( this, 955 SIGNAL( legendDataChanged( 956 const QVariant &, const QList<QwtLegendData> & ) ), 957 d_data->legend, 958 SLOT( updateLegend( 959 const QVariant &, const QList<QwtLegendData> & ) ) 952 connect( 953 this, SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)), 954 d_data->legend, SLOT(updateLegend(QVariant,QList<QwtLegendData>) ) 960 955 ); 961 956 … … 1088 1083 1089 1084 /*! 1090 \brief Attach/Detach a plot item 1085 \brief Attach/Detach a plot item 1091 1086 1092 1087 \param plotItem Plot item … … 1116 1111 if ( on ) 1117 1112 insertItem( plotItem ); 1118 else 1113 else 1119 1114 removeItem( plotItem ); 1120 1115 … … 1168 1163 that has bee generated from itemToInfo(). 1169 1164 1170 The default implementation simply tries to unwrap a QwtPlotItem 1165 The default implementation simply tries to unwrap a QwtPlotItem 1171 1166 pointer: 1172 1167 -
trunk/BNC/qwt/qwt_plot.h
r8127 r9383 41 41 can be configured separately for each axis. 42 42 43 The simpleplot example is a good starting point to see how to set up a 43 The simpleplot example is a good starting point to see how to set up a 44 44 plot widget. 45 45 … … 47 47 48 48 \par Example 49 The following example shows (schematically) the most simple 50 way to use QwtPlot. By default, only the left and bottom axes are 51 visible and their scales are computed automatically. 52 \verbatim 53 #include <qwt_plot.h> 54 #include <qwt_plot_curve.h> 55 56 QwtPlot *myPlot = new QwtPlot("Two Curves", parent); 57 58 // add curves 59 QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1"); 60 QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2"); 61 62 // connect or copy the data to the curves 63 curve1->setData(...); 64 curve2->setData(...); 65 66 curve1->attach(myPlot); 67 curve2->attach(myPlot); 68 69 // finally, refresh the plot 70 myPlot->replot(); 71 \endverbatim 49 The following example shows (schematically) the most simple 50 way to use QwtPlot. By default, only the left and bottom axes are 51 visible and their scales are computed automatically. 52 \code 53 #include <qwt_plot.h> 54 #include <qwt_plot_curve.h> 55 56 QwtPlot *myPlot = new QwtPlot( "Two Curves", parent ); 57 58 // add curves 59 QwtPlotCurve *curve1 = new QwtPlotCurve( "Curve 1" ); 60 QwtPlotCurve *curve2 = new QwtPlotCurve( "Curve 2" ); 61 62 // connect or copy the data to the curves 63 curve1->setData( ... ); 64 curve2->setData( ... ); 65 66 curve1->attach( myPlot ); 67 curve2->attach( myPlot ); 68 69 // finally, refresh the plot 70 myPlot->replot(); 71 \endcode 72 \endpar 72 73 */ 73 74 … … 76 77 Q_OBJECT 77 78 78 Q_PROPERTY( QBrush canvasBackground 79 Q_PROPERTY( QBrush canvasBackground 79 80 READ canvasBackground WRITE setCanvasBackground ) 80 81 Q_PROPERTY( bool autoReplot READ autoReplot WRITE setAutoReplot ) … … 122 123 RightLegend, 123 124 124 //! The legend will be below the footer 125 //! The legend will be below the footer 125 126 BottomLegend, 126 127 … … 150 151 151 152 void setTitle( const QString & ); 152 void setTitle( const QwtText & t);153 void setTitle( const QwtText & ); 153 154 QwtText title() const; 154 155 … … 159 160 160 161 void setFooter( const QString & ); 161 void setFooter( const QwtText & t);162 void setFooter( const QwtText & ); 162 163 QwtText footer() const; 163 164 … … 192 193 bool axisEnabled( int axisId ) const; 193 194 194 void setAxisFont( int axisId, const QFont & f);195 void setAxisFont( int axisId, const QFont & ); 195 196 QFont axisFont( int axisId ) const; 196 197 197 void setAxisScale( int axisId, double min, double max, double step = 0 );198 void setAxisScale( int axisId, double min, double max, double stepSize = 0 ); 198 199 void setAxisScaleDiv( int axisId, const QwtScaleDiv & ); 199 200 void setAxisScaleDraw( int axisId, QwtScaleDraw * ); … … 225 226 // Legend 226 227 227 void insertLegend( QwtAbstractLegend *, 228 void insertLegend( QwtAbstractLegend *, 228 229 LegendPosition = QwtPlot::RightLegend, double ratio = -1.0 ); 229 230 … … 245 246 void updateCanvasMargins(); 246 247 247 virtual void getCanvasMarginsHint( 248 virtual void getCanvasMarginsHint( 248 249 const QwtScaleMap maps[], const QRectF &canvasRect, 249 250 double &left, double &top, double &right, double &bottom) const; … … 268 269 269 270 /*! 270 A signal with the attributes how to update 271 A signal with the attributes how to update 271 272 the legend entries for a plot item. 272 273 … … 277 278 \sa itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend() 278 279 */ 279 void legendDataChanged( const QVariant &itemInfo, 280 void legendDataChanged( const QVariant &itemInfo, 280 281 const QList<QwtLegendData> &data ); 281 282 … … 291 292 private Q_SLOTS: 292 293 void updateLegendItems( const QVariant &itemInfo, 293 const QList<QwtLegendData> & data );294 const QList<QwtLegendData> &legendData ); 294 295 295 296 private: -
trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp
r8127 r9383 181 181 \brief Set the baseline 182 182 183 The baseline is the origin for the chart. Each bar is 184 painted from the baseline in the direction of the sample 183 The baseline is the origin for the chart. Each bar is 184 painted from the baseline in the direction of the sample 185 185 value. In case of a horizontal orientation() the baseline 186 186 is interpreted as x - otherwise as y - value. … … 201 201 } 202 202 203 /*! 203 /*! 204 204 \return Value for the origin of the bar chart 205 205 \sa setBaseline(), QwtPlotSeriesItem::orientation() … … 286 286 QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins() 287 287 */ 288 void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap &xMap, 288 void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap &xMap, 289 289 const QwtScaleMap &yMap, const QRectF &canvasRect, 290 290 double &left, double &top, double &right, double &bottom ) const -
trunk/BNC/qwt/qwt_plot_abstract_barchart.h
r8127 r9383 18 18 \brief Abstract base class for bar chart items 19 19 20 In opposite to almost all other plot items bar charts can't be 20 In opposite to almost all other plot items bar charts can't be 21 21 displayed inside of their bounding rectangle and need a special 22 22 API how to calculate the width of the bars and how they affect … … 79 79 double baseline() const; 80 80 81 virtual void getCanvasMarginHint( 81 virtual void getCanvasMarginHint( 82 82 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 83 83 const QRectF &canvasRect, … … 87 87 protected: 88 88 double sampleWidth( const QwtScaleMap &map, 89 double canvasSize, double dataSize,89 double canvasSize, double boundingSize, 90 90 double value ) const; 91 91 -
trunk/BNC/qwt/qwt_plot_axis.cpp
r8127 r9383 68 68 d.scaleEngine = new QwtLinearScaleEngine; 69 69 70 d.scaleWidget->setTransformation( 70 d.scaleWidget->setTransformation( 71 71 d.scaleEngine->transformation() ); 72 72 … … 148 148 d.scaleEngine = scaleEngine; 149 149 150 d_axisData[axisId]->scaleWidget->setTransformation( 150 d_axisData[axisId]->scaleWidget->setTransformation( 151 151 scaleEngine->transformation() ); 152 152 … … 190 190 else 191 191 return false; 192 193 192 } 194 193 … … 289 288 290 289 /*! 291 \brief Return the step size parameter that has been set in setAxisScale. 290 \brief Return the step size parameter that has been set in setAxisScale. 292 291 293 292 This doesn't need to be the step size of the current scale. … … 310 309 311 310 This is only a convenience function for axisScaleDiv( axisId )->interval(); 312 311 313 312 \param axisId Axis index 314 313 \return Scale interval … … 434 433 \brief Disable autoscaling and specify a fixed scale for a selected axis. 435 434 436 In updateAxes() the scale engine calculates a scale division from the 437 specified parameters, that will be assigned to the scale widget. So 435 In updateAxes() the scale engine calculates a scale division from the 436 specified parameters, that will be assigned to the scale widget. So 438 437 updates of the scale widget usually happen delayed with the next replot. 439 438 … … 467 466 468 467 The scale division will be stored locally only until the next call 469 of updateAxes(). So updates of the scale widget usually happen delayed with 468 of updateAxes(). So updates of the scale widget usually happen delayed with 470 469 the next replot. 471 470 … … 615 614 } 616 615 617 /*! 616 /*! 618 617 \brief Rebuild the axes scales 619 618 620 In case of autoscaling the boundaries of a scale are calculated 621 from the bounding rectangles of all plot items, having the 622 QwtPlotItem::AutoScale flag enabled ( QwtScaleEngine::autoScale() ). 623 Then a scale division is calculated ( QwtScaleEngine::didvideScale() ) 619 In case of autoscaling the boundaries of a scale are calculated 620 from the bounding rectangles of all plot items, having the 621 QwtPlotItem::AutoScale flag enabled ( QwtScaleEngine::autoScale() ). 622 Then a scale division is calculated ( QwtScaleEngine::didvideScale() ) 624 623 and assigned to scale widget. 625 624 626 When the scale boundaries have been assigned with setAxisScale() a 625 When the scale boundaries have been assigned with setAxisScale() a 627 626 scale division is calculated ( QwtScaleEngine::didvideScale() ) 628 627 for this interval and assigned to the scale widget. 629 628 630 When the scale has been set explicitly by setAxisScaleDiv() the 629 When the scale has been set explicitly by setAxisScaleDiv() the 631 630 locally stored scale division gets assigned to the scale widget. 632 631 633 The scale widget indicates modifications by emitting a 632 The scale widget indicates modifications by emitting a 634 633 QwtScaleWidget::scaleDivChanged() signal. 635 634 636 updateAxes() is usually called by replot(). 635 updateAxes() is usually called by replot(). 637 636 638 637 \sa setAxisAutoScale(), setAxisScale(), setAxisScaleDiv(), replot() -
trunk/BNC/qwt/qwt_plot_barchart.cpp
r8127 r9383 22 22 { 23 23 } 24 24 25 25 ~PrivateData() 26 26 { … … 121 121 122 122 The bar chart will take the ownership of the symbol, hence the previously 123 set symbol will be delete by setting a new one. If \p symbol is 123 set symbol will be delete by setting a new one. If \p symbol is 124 124 \c NULL no symbol will be drawn. 125 125 … … 305 305 306 306 /*! 307 Draw a bar 307 Draw a bar 308 308 309 309 \param painter Painter … … 313 313 */ 314 314 void QwtPlotBarChart::drawBar( QPainter *painter, 315 int sampleIndex, const QPointF &sample, 315 int sampleIndex, const QPointF &sample, 316 316 const QwtColumnRect &rect ) const 317 317 { 318 const QwtColumnSymbol *specialSym = 318 const QwtColumnSymbol *specialSym = 319 319 specialSymbol( sampleIndex, sample ); 320 320 … … 330 330 { 331 331 // we build a temporary default symbol 332 QwtColumnSymbol sym( QwtColumnSymbol::Box );333 sym.setLineWidth( 1 );334 sym.setFrameStyle( QwtColumnSymbol::Plain );335 sym.draw( painter, rect );332 QwtColumnSymbol columnSymbol( QwtColumnSymbol::Box ); 333 columnSymbol.setLineWidth( 1 ); 334 columnSymbol.setFrameStyle( QwtColumnSymbol::Plain ); 335 columnSymbol.draw( painter, rect ); 336 336 } 337 337 … … 340 340 341 341 /*! 342 Needs to be overloaded to return a 342 Needs to be overloaded to return a 343 343 non default symbol for a specific sample 344 344 … … 348 348 \return NULL, indicating to use the default symbol 349 349 */ 350 QwtColumnSymbol *QwtPlotBarChart::specialSymbol( 350 QwtColumnSymbol *QwtPlotBarChart::specialSymbol( 351 351 int sampleIndex, const QPointF &sample ) const 352 352 { … … 429 429 displays the default symbol. 430 430 431 \param index Index of the legend entry 431 \param index Index of the legend entry 432 432 \param size Icon size 433 433 434 \sa setLegendMode(), drawBar(), 434 \sa setLegendMode(), drawBar(), 435 435 QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData() 436 436 */ 437 QwtGraphic QwtPlotBarChart::legendIcon( 437 QwtGraphic QwtPlotBarChart::legendIcon( 438 438 int index, const QSizeF &size ) const 439 439 { … … 453 453 if ( d_data->legendMode == QwtPlotBarChart::LegendBarTitles ) 454 454 barIndex = index; 455 455 456 456 drawBar( &painter, barIndex, QPointF(), column ); 457 457 -
trunk/BNC/qwt/qwt_plot_barchart.h
r8127 r9383 24 24 a specialSymbol(). Otherwise it is rendered using a default symbol. 25 25 26 Depending on its orientation() the bars are displayed horizontally 27 or vertically. The bars cover the interval between the baseline() 26 Depending on its orientation() the bars are displayed horizontally 27 or vertically. The bars cover the interval between the baseline() 28 28 and the value. 29 29 … … 51 51 enum LegendMode 52 52 { 53 /*! 53 /*! 54 54 One entry on the legend showing the default symbol 55 55 and the title() of the chart … … 68 68 }; 69 69 70 explicit QwtPlotBarChart( const QString &title = QString ::null);70 explicit QwtPlotBarChart( const QString &title = QString() ); 71 71 explicit QwtPlotBarChart( const QwtText &title ); 72 72 … … 77 77 void setSamples( const QVector<QPointF> & ); 78 78 void setSamples( const QVector<double> & ); 79 void setSamples( QwtSeriesData<QPointF> * series);79 void setSamples( QwtSeriesData<QPointF> * ); 80 80 81 81 void setSymbol( QwtColumnSymbol * ); … … 91 91 virtual QRectF boundingRect() const; 92 92 93 virtual QwtColumnSymbol *specialSymbol( 93 virtual QwtColumnSymbol *specialSymbol( 94 94 int sampleIndex, const QPointF& ) const; 95 95 … … 103 103 104 104 virtual void drawBar( QPainter *, 105 int sampleIndex, const QPointF& point,105 int sampleIndex, const QPointF& sample, 106 106 const QwtColumnRect & ) const; 107 107 -
trunk/BNC/qwt/qwt_plot_canvas.cpp
r8127 r9383 49 49 } 50 50 51 virtual void drawRects(const QRect *rects, int count ) 52 { 53 // to silence -Woverloaded-virtual 54 QwtNullPaintDevice::drawRects( rects, count ); 55 } 56 51 57 virtual void drawPath( const QPainterPath &path ) 52 58 { … … 73 79 for ( int i = 0; i < path.elementCount(); i++ ) 74 80 { 75 QPainterPath::Element el = path.elementAt(i); 81 QPainterPath::Element el = path.elementAt(i); 76 82 switch( el.type ) 77 83 { … … 98 104 { 99 105 QRectF r = clipRects.last(); 100 r.setCoords( 106 r.setCoords( 101 107 qMin( r.left(), el.x ), 102 108 qMin( r.top(), el.y ), … … 170 176 painter->setClipPath( borderClip, Qt::IntersectClip ); 171 177 172 const QBrush &brush = 178 const QBrush &brush = 173 179 canvas->palette().brush( canvas->backgroundRole() ); 174 180 … … 186 192 { 187 193 rects += canvas->rect(); 188 } 189 else 194 } 195 else 190 196 { 191 197 rects = painter->clipRegion().rects(); … … 197 203 if ( painter->paintEngine()->type() == QPaintEngine::X11 ) 198 204 { 199 // Qt 4.7.1: gradients on X11 are broken ( subrects + 205 // Qt 4.7.1: gradients on X11 are broken ( subrects + 200 206 // QGradient::StretchToDeviceMode ) and horrible slow. 201 207 // As workaround we have to use the raster paintengine. … … 223 229 } 224 230 } 225 231 226 232 QImage image( canvas->size(), format ); 227 233 … … 268 274 } 269 275 270 static QPainterPath qwtCombinePathList( const QRectF &rect, 276 static QPainterPath qwtCombinePathList( const QRectF &rect, 271 277 const QList<QPainterPath> &pathList ) 272 278 { … … 286 292 if ( br.center().y() < rect.center().y() ) 287 293 { 288 if ( qAbs( br.top() - rect.top() ) < 294 if ( qAbs( br.top() - rect.top() ) < 289 295 qAbs( br.left() - rect.left() ) ) 290 296 { … … 298 304 else 299 305 { 300 if ( qAbs( br.bottom() - rect.bottom() ) < 306 if ( qAbs( br.bottom() - rect.bottom() ) < 301 307 qAbs( br.left() - rect.left() ) ) 302 308 { … … 316 322 if ( br.center().y() < rect.center().y() ) 317 323 { 318 if ( qAbs( br.top() - rect.top() ) < 324 if ( qAbs( br.top() - rect.top() ) < 319 325 qAbs( br.right() - rect.right() ) ) 320 326 { … … 328 334 else 329 335 { 330 if ( qAbs( br.bottom() - rect.bottom() ) < 336 if ( qAbs( br.bottom() - rect.bottom() ) < 331 337 qAbs( br.right() - rect.right() ) ) 332 338 { … … 340 346 if ( subPath.currentPosition().y() < br.center().y() ) 341 347 qwtRevertPath( subPath ); 342 } 348 } 343 349 ordered[index] = subPath; 344 350 } … … 381 387 } 382 388 383 static inline void qwtDrawStyledBackground( 389 static inline void qwtDrawStyledBackground( 384 390 QWidget *w, QPainter *painter ) 385 391 { … … 418 424 } 419 425 420 static void qwtFillBackground( QPainter *painter, 426 static void qwtFillBackground( QPainter *painter, 421 427 QWidget *widget, const QVector<QRectF> &fillRects ) 422 428 { … … 521 527 }; 522 528 523 /*! 529 /*! 524 530 \brief Constructor 525 531 … … 595 601 *d_data->backingStore = grab( rect() ); 596 602 #else 597 *d_data->backingStore = 603 *d_data->backingStore = 598 604 QPixmap::grabWidget( this, rect() ); 599 605 #endif … … 695 701 bool QwtPlotCanvas::event( QEvent *event ) 696 702 { 697 if ( event->type() == QEvent::PolishRequest ) 703 if ( event->type() == QEvent::PolishRequest ) 698 704 { 699 705 if ( testPaintAttribute( QwtPlotCanvas::Opaque ) ) 700 706 { 701 // Setting a style sheet changes the 707 // Setting a style sheet changes the 702 708 // Qt::WA_OpaquePaintEvent attribute, but we insist 703 709 // on painting the background. 704 710 705 711 setAttribute( Qt::WA_OpaquePaintEvent, true ); 706 712 } 707 713 } 708 714 709 if ( event->type() == QEvent::PolishRequest || 715 if ( event->type() == QEvent::PolishRequest || 710 716 event->type() == QEvent::StyleChange ) 711 717 { … … 729 735 { 730 736 QPixmap &bs = *d_data->backingStore; 731 if ( bs.size() != size() ) 737 738 qreal pixelRatio = 1.0; 739 740 #if QT_VERSION >= 0x050000 741 pixelRatio = bs.devicePixelRatio(); 742 #endif 743 744 if ( bs.size() != size() * pixelRatio ) 732 745 { 733 746 bs = QwtPainter::backingStore( this, size() ); … … 806 819 drawCanvas( &painter, false ); 807 820 808 if ( frameWidth() > 0 ) 821 if ( frameWidth() > 0 ) 809 822 drawBorder( &painter ); 810 823 } … … 815 828 } 816 829 817 void QwtPlotCanvas::drawCanvas( QPainter *painter, bool withBackground ) 830 void QwtPlotCanvas::drawCanvas( QPainter *painter, bool withBackground ) 818 831 { 819 832 bool hackStyledBackground = false; 820 833 821 if ( withBackground && testAttribute( Qt::WA_StyledBackground ) 834 if ( withBackground && testAttribute( Qt::WA_StyledBackground ) 822 835 && testPaintAttribute( HackStyledBackground ) ) 823 836 { 824 837 // Antialiasing rounded borders is done by 825 // inserting pixels with colors between the 838 // inserting pixels with colors between the 826 839 // border color and the color on the canvas, 827 840 // When the border is painted before the plot items … … 853 866 854 867 painter->setPen( Qt::NoPen ); 855 painter->setBrush( d_data->styleSheet.background.brush ); 868 painter->setBrush( d_data->styleSheet.background.brush ); 856 869 painter->setBrushOrigin( d_data->styleSheet.background.origin ); 857 870 painter->setClipPath( d_data->styleSheet.borderPath ); … … 894 907 if ( !d_data->styleSheet.borderPath.isEmpty() ) 895 908 { 896 painter->setClipPath( 909 painter->setClipPath( 897 910 d_data->styleSheet.borderPath, Qt::IntersectClip ); 898 911 } … … 930 943 if ( frameWidth() > 0 ) 931 944 { 932 QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ), 945 QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ), 933 946 d_data->borderRadius, d_data->borderRadius, 934 947 palette(), frameWidth(), frameStyle() ); … … 953 966 #endif 954 967 955 switch (frameShape) 968 switch (frameShape) 956 969 { 957 970 case QFrame::Box: … … 963 976 opt.lineWidth = lineWidth(); 964 977 opt.midLineWidth = midLineWidth(); 965 break; 966 } 967 default: 978 break; 979 } 980 default: 968 981 { 969 982 opt.lineWidth = frameWidth(); … … 971 984 } 972 985 } 973 986 974 987 if ( frameShadow == Sunken ) 975 988 opt.state |= QStyle::State_Sunken; … … 1030 1043 1031 1044 QwtStyleSheetRecorder recorder( size() ); 1032 1045 1033 1046 QPainter painter( &recorder ); 1034 1047 1035 1048 QStyleOption opt; 1036 1049 opt.initFrom(this); 1037 1050 style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, this); 1038 1051 1039 1052 painter.end(); 1040 1053 … … 1046 1059 if ( !recorder.border.rectList.isEmpty() ) 1047 1060 { 1048 d_data->styleSheet.borderPath = 1061 d_data->styleSheet.borderPath = 1049 1062 qwtCombinePathList( rect(), recorder.border.pathList ); 1050 1063 } … … 1097 1110 return path; 1098 1111 } 1099 1112 1100 1113 return QPainterPath(); 1101 1114 } -
trunk/BNC/qwt/qwt_plot_canvas.h
r8127 r9383 20 20 /*! 21 21 \brief Canvas of a QwtPlot. 22 22 23 23 Canvas is the widget where all plot items are displayed 24 24 … … 43 43 { 44 44 /*! 45 \brief Paint double buffered reusing the content 46 of the pixmap buffer when possible. 45 \brief Paint double buffered reusing the content 46 of the pixmap buffer when possible. 47 47 48 48 Using a backing store might improve the performance … … 60 60 61 61 When using styled backgrounds Qt assumes, that the 62 canvas doesn't fill its area completely 62 canvas doesn't fill its area completely 63 63 ( f.e because of rounded borders ) and fills the area 64 64 below the canvas. When this is done with gradients it might … … 66 66 67 67 When the Opaque attribute is enabled the canvas tries to 68 identify the gaps with some heuristics and to fill those only. 68 identify the gaps with some heuristics and to fill those only. 69 69 70 \warning Will not work for semitransparent backgrounds 70 \warning Will not work for semitransparent backgrounds 71 71 */ 72 72 Opaque = 2, -
trunk/BNC/qwt/qwt_plot_curve.cpp
r8127 r9383 25 25 static void qwtUpdateLegendIconSize( QwtPlotCurve *curve ) 26 26 { 27 if ( curve->symbol() && 27 if ( curve->symbol() && 28 28 curve->testLegendAttribute( QwtPlotCurve::LegendShowSymbol ) ) 29 29 { … … 68 68 symbol( NULL ), 69 69 attributes( 0 ), 70 paintAttributes( 70 paintAttributes( 71 71 QwtPlotCurve::ClipPolygons | QwtPlotCurve::FilterPoints ), 72 72 legendAttributes( 0 ) … … 225 225 226 226 The curve will take the ownership of the symbol, hence the previously 227 set symbol will be delete by setting a new one. If \p symbol is 227 set symbol will be delete by setting a new one. If \p symbol is 228 228 \c NULL no symbol will be drawn. 229 229 … … 475 475 476 476 if ( !doFit && !doFill ) 477 doIntegers = true; 477 doIntegers = true; 478 478 } 479 479 #endif … … 488 488 if ( doIntegers ) 489 489 { 490 QPolygon polyline = mapper.toPolygon( 490 QPolygon polyline = mapper.toPolygon( 491 491 xMap, yMap, data(), from, to ); 492 492 493 493 if ( d_data->paintAttributes & ClipPolygons ) 494 494 { 495 polyline = QwtClipper::clipPolygon( 495 polyline = QwtClipper::clipPolygon( 496 496 clipRect.toAlignedRect(), polyline, false ); 497 497 } … … 519 519 if ( d_data->paintAttributes & ClipPolygons ) 520 520 { 521 polyline = QwtClipper::clipPolygonF( 521 polyline = QwtClipper::clipPolygonF( 522 522 clipRect, polyline, false ); 523 523 } … … 557 557 void QwtPlotCurve::drawSticks( QPainter *painter, 558 558 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 559 const QRectF &, int from, int to ) const 560 { 559 const QRectF &canvasRect, int from, int to ) const 560 { 561 Q_UNUSED( canvasRect ) 562 561 563 painter->save(); 562 564 painter->setRenderHint( QPainter::Antialiasing, false ); … … 640 642 mapper.setFlag( QwtPointMapper::WeedOutPoints, false ); 641 643 642 QPolygonF points = mapper.toPointsF( 644 QPolygonF points = mapper.toPointsF( 643 645 xMap, yMap, data(), from, to ); 644 646 … … 649 651 { 650 652 const QImage image = mapper.toImage( xMap, yMap, 651 data(), from, to, d_data->pen, 653 data(), from, to, d_data->pen, 652 654 painter->testRenderHint( QPainter::Antialiasing ), 653 655 renderThreadCount() ); … … 680 682 { 681 683 const QPolygon points = mapper.toPoints( 682 xMap, yMap, data(), from, to ); 684 xMap, yMap, data(), from, to ); 683 685 684 686 QwtPainter::drawPoints( painter, points ); … … 686 688 else 687 689 { 688 const QPolygonF points = mapper.toPointsF( 690 const QPolygonF points = mapper.toPointsF( 689 691 xMap, yMap, data(), from, to ); 690 692 … … 761 763 qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF()); 762 764 const QRectF clipRect = canvasRect.adjusted(-pw, -pw, pw, pw); 763 764 const QPolygonF clipped = QwtClipper::clipPolygonF( 765 766 const QPolygonF clipped = QwtClipper::clipPolygonF( 765 767 clipRect, polygon, false ); 766 768 … … 884 886 885 887 /*! 886 \brief Complete a polygon to be a closed polygon including the 888 \brief Complete a polygon to be a closed polygon including the 887 889 area between the original polygon and the baseline. 888 890 … … 902 904 903 905 double baseline = d_data->baseline; 904 906 905 907 if ( orientation() == Qt::Vertical ) 906 908 { … … 947 949 { 948 950 QwtPointMapper mapper; 949 mapper.setFlag( QwtPointMapper::RoundPoints, 951 mapper.setFlag( QwtPointMapper::RoundPoints, 950 952 QwtPainter::roundingAlignment( painter ) ); 951 mapper.setFlag( QwtPointMapper::WeedOutPoints, 953 mapper.setFlag( QwtPointMapper::WeedOutPoints, 952 954 testPaintAttribute( QwtPlotCurve::FilterPoints ) ); 953 955 mapper.setBoundingRect( canvasRect ); … … 974 976 975 977 The interpretation of the baseline depends on the orientation(). 976 With Qt:: Horizontal, the baseline is interpreted as a horizontal line977 at y = baseline(), with Qt:: Vertical, it is interpreted as a vertical978 With Qt::Vertical, the baseline is interpreted as a horizontal line 979 at y = baseline(), with Qt::Horizontal, it is interpreted as a vertical 978 980 line at x = baseline(). 979 981 … … 1050 1052 \return Icon representing the curve on the legend 1051 1053 1052 \param index Index of the legend entry 1054 \param index Index of the legend entry 1053 1055 ( ignored as there is only one ) 1054 1056 \param size Icon size … … 1056 1058 \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData() 1057 1059 */ 1058 QwtGraphic QwtPlotCurve::legendIcon( int index, 1060 QwtGraphic QwtPlotCurve::legendIcon( int index, 1059 1061 const QSizeF &size ) const 1060 1062 { … … 1154 1156 1155 1157 /*! 1156 \brief Initialize the data by pointing to memory blocks which 1158 \brief Initialize the data by pointing to memory blocks which 1157 1159 are not managed by QwtPlotCurve. 1158 1160 1159 setRawSamples is provided for efficiency. 1161 setRawSamples is provided for efficiency. 1160 1162 It is important to keep the pointers 1161 1163 during the lifetime of the underlying QwtCPointerData class. … … 1167 1169 \sa QwtCPointerData 1168 1170 */ 1169 void QwtPlotCurve::setRawSamples( 1171 void QwtPlotCurve::setRawSamples( 1170 1172 const double *xData, const double *yData, int size ) 1171 1173 { … … 1184 1186 \sa QwtPointArrayData 1185 1187 */ 1186 void QwtPlotCurve::setSamples( 1188 void QwtPlotCurve::setSamples( 1187 1189 const double *xData, const double *yData, int size ) 1188 1190 { -
trunk/BNC/qwt/qwt_plot_curve.h
r8127 r9383 34 34 <dl><dt>a) Assign curve properties</dt> 35 35 <dd>When a curve is created, it is configured to draw black solid lines 36 with in QwtPlotCurve::Lines style and no symbols. 36 with in QwtPlotCurve::Lines style and no symbols. 37 37 You can change this by calling 38 38 setPen(), setStyle() and setSymbol().</dd> … … 53 53 \sa QwtPointSeriesData, QwtSymbol, QwtScaleMap 54 54 */ 55 class QWT_EXPORT QwtPlotCurve: 55 class QWT_EXPORT QwtPlotCurve: 56 56 public QwtPlotSeriesItem, public QwtSeriesStore<QPointF> 57 57 { … … 76 76 77 77 /*! 78 Draw vertical or horizontal sticks ( depending on the 78 Draw vertical or horizontal sticks ( depending on the 79 79 orientation() ) from a baseline which is defined by setBaseline(). 80 80 */ … … 91 91 Draw dots at the locations of the data points. Note: 92 92 This is different from a dotted line (see setPen()), and faster 93 as a curve in QwtPlotCurve::NoStyle style and a symbol 93 as a curve in QwtPlotCurve::NoStyle style and a symbol 94 94 painting a point. 95 95 */ … … 111 111 { 112 112 /*! 113 For QwtPlotCurve::Steps only. 113 For QwtPlotCurve::Steps only. 114 114 Draws a step function from the right to the left. 115 115 */ … … 142 142 { 143 143 /*! 144 QwtPlotCurve tries to find a color representing the curve 144 QwtPlotCurve tries to find a color representing the curve 145 145 and paints a rectangle with it. 146 146 */ … … 148 148 149 149 /*! 150 If the style() is not QwtPlotCurve::NoCurve a line 150 If the style() is not QwtPlotCurve::NoCurve a line 151 151 is painted with the curve pen(). 152 152 */ … … 192 192 193 193 /*! 194 Minimize memory usage that is temporarily needed for the 194 Minimize memory usage that is temporarily needed for the 195 195 translated points, before they get painted. 196 This might slow down the performance of painting 196 This might slow down the performance of painting 197 197 */ 198 198 MinimizeMemory = 0x04, … … 201 201 Render the points to a temporary image and paint the image. 202 202 This is a very special optimization for Dots style, when 203 having a huge amount of points. 203 having a huge amount of points. 204 204 With a reasonable number of points QPainter::drawPoints() 205 205 will be faster. … … 211 211 typedef QFlags<PaintAttribute> PaintAttributes; 212 212 213 explicit QwtPlotCurve( const QString &title = QString ::null);213 explicit QwtPlotCurve( const QString &title = QString() ); 214 214 explicit QwtPlotCurve( const QwtText &title ); 215 215 … … 271 271 void init(); 272 272 273 virtual void drawCurve( QPainter * p, int style,274 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 275 const QRectF &canvasRect, int from, int to ) const; 276 277 virtual void drawSymbols( QPainter * p, const QwtSymbol &,278 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 279 const QRectF &canvasRect, int from, int to ) const; 280 281 virtual void drawLines( QPainter * p,282 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 283 const QRectF &canvasRect, int from, int to ) const; 284 285 virtual void drawSticks( QPainter * p,286 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 287 const QRectF &canvasRect, int from, int to ) const; 288 289 virtual void drawDots( QPainter * p,290 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 291 const QRectF &canvasRect, int from, int to ) const; 292 293 virtual void drawSteps( QPainter * p,273 virtual void drawCurve( QPainter *, int style, 274 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 275 const QRectF &canvasRect, int from, int to ) const; 276 277 virtual void drawSymbols( QPainter *, const QwtSymbol &, 278 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 279 const QRectF &canvasRect, int from, int to ) const; 280 281 virtual void drawLines( QPainter *, 282 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 283 const QRectF &canvasRect, int from, int to ) const; 284 285 virtual void drawSticks( QPainter *, 286 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 287 const QRectF &canvasRect, int from, int to ) const; 288 289 virtual void drawDots( QPainter *, 290 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 291 const QRectF &canvasRect, int from, int to ) const; 292 293 virtual void drawSteps( QPainter *, 294 294 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 295 295 const QRectF &canvasRect, int from, int to ) const; 296 296 297 297 virtual void fillCurve( QPainter *, 298 const QwtScaleMap &, const QwtScaleMap &, 298 const QwtScaleMap &, const QwtScaleMap &, 299 299 const QRectF &canvasRect, QPolygonF & ) const; 300 300 -
trunk/BNC/qwt/qwt_plot_dict.cpp
r8127 r9383 138 138 { 139 139 PrivateData::ItemList list = d_data->itemList; 140 QwtPlotItemIterator it = list. begin();141 while ( it != list. end() )140 QwtPlotItemIterator it = list.constBegin(); 141 while ( it != list.constEnd() ) 142 142 { 143 143 QwtPlotItem *item = *it; … … 181 181 182 182 PrivateData::ItemList list = d_data->itemList; 183 for ( QwtPlotItemIterator it = list. begin(); it != list.end(); ++it )183 for ( QwtPlotItemIterator it = list.constBegin(); it != list.constEnd(); ++it ) 184 184 { 185 185 QwtPlotItem *item = *it; -
trunk/BNC/qwt/qwt_plot_directpainter.cpp
r8127 r9383 18 18 #include <qpixmap.h> 19 19 20 static inline void qwtRenderItem( 20 static inline void qwtRenderItem( 21 21 QPainter *painter, const QRect &canvasRect, 22 22 QwtPlotSeriesItem *seriesItem, int from, int to ) … … 110 110 111 111 /*! 112 En/Disables clipping 112 En/Disables clipping 113 113 114 114 \param enable Enables clipping is true, disable it otherwise … … 132 132 \brief Assign a clip region and enable clipping 133 133 134 Depending on the environment setting a proper clip region might improve 134 Depending on the environment setting a proper clip region might improve 135 135 the performance heavily. F.e. on Qt embedded only the clipped part of 136 136 the backing store will be copied to a ( maybe unaccelerated ) frame buffer 137 137 device. 138 138 139 139 \param region Clip region 140 140 \sa clipRegion(), hasClipping(), setClipping() … … 201 201 202 202 bool immediatePaint = true; 203 if ( !canvas->testAttribute( Qt::WA_WState_InPaintEvent ) ) 203 if ( !canvas->testAttribute( Qt::WA_WState_InPaintEvent ) ) 204 204 { 205 205 #if QT_VERSION < 0x050000 … … 221 221 if ( d_data->hasClipping ) 222 222 { 223 d_data->painter.setClipRegion( 223 d_data->painter.setClipRegion( 224 224 QRegion( canvasRect ) & d_data->clipRegion ); 225 225 } … … 295 295 if ( doCopyCache ) 296 296 { 297 QwtPlotCanvas *plotCanvas = 297 QwtPlotCanvas *plotCanvas = 298 298 qobject_cast<QwtPlotCanvas *>( canvas ); 299 299 if ( plotCanvas ) … … 302 302 if ( doCopyCache ) 303 303 { 304 painter.drawPixmap( plotCanvas->rect().topLeft(), 304 painter.drawPixmap( plotCanvas->rect().topLeft(), 305 305 *plotCanvas->backingStore() ); 306 306 } -
trunk/BNC/qwt/qwt_plot_directpainter.h
r8127 r9383 30 30 On certain environments it might be important to calculate a proper 31 31 clip region before painting. F.e. for Qt Embedded only the clipped part 32 of the backing store will be copied to a ( maybe unaccelerated ) 32 of the backing store will be copied to a ( maybe unaccelerated ) 33 33 frame buffer. 34 34 … … 62 62 /*! 63 63 When QwtPlotCanvas::BackingStore is enabled the painter 64 has to paint to the backing store and the widget. In certain 65 situations/environments it might be faster to paint to 64 has to paint to the backing store and the widget. In certain 65 situations/environments it might be faster to paint to 66 66 the backing store only and then copy the backing store to the canvas. 67 67 This flag can also be useful for settings, where Qt fills the -
trunk/BNC/qwt/qwt_plot_glcanvas.cpp
r8127 r9383 25 25 for ( ; w->parentWidget() != NULL; w = w->parentWidget() ) 26 26 { 27 if ( w->autoFillBackground() || 27 if ( w->autoFillBackground() || 28 28 w->testAttribute( Qt::WA_StyledBackground ) ) 29 29 { … … 66 66 }; 67 67 68 /*! 68 /*! 69 69 \brief Constructor 70 70 … … 94 94 Set the frame style 95 95 96 \param style The bitwise OR between a shape and a shadow. 97 98 \sa frameStyle(), QFrame::setFrameStyle(), 96 \param style The bitwise OR between a shape and a shadow. 97 98 \sa frameStyle(), QFrame::setFrameStyle(), 99 99 setFrameShadow(), setFrameShape() 100 100 */ … … 209 209 \return Midline width of the frame 210 210 \sa setMidLineWidth(), lineWidth() 211 */ 211 */ 212 212 int QwtPlotGLCanvas::midLineWidth() const 213 213 { … … 279 279 280 280 \sa QwtPlot::drawCanvas() 281 */ 281 */ 282 282 void QwtPlotGLCanvas::drawItems( QPainter *painter ) 283 283 { … … 296 296 Draw the background of the canvas 297 297 \param painter Painter 298 */ 298 */ 299 299 void QwtPlotGLCanvas::drawBackground( QPainter *painter ) 300 300 { … … 316 316 w->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, w); 317 317 } 318 else 318 else 319 319 { 320 320 painter->fillRect( fillRect, … … 337 337 if ( frameShadow() == QwtPlotGLCanvas::Plain ) 338 338 { 339 qDrawPlainRect( painter, frameRect(), 339 qDrawPlainRect( painter, frameRect(), 340 340 palette().shadow().color(), lineWidth() ); 341 341 } … … 349 349 else 350 350 { 351 qDrawShadePanel( painter, frameRect(), palette(), 351 qDrawShadePanel( painter, frameRect(), palette(), 352 352 frameShadow() == Sunken, lineWidth() ); 353 353 } -
trunk/BNC/qwt/qwt_plot_glcanvas.h
r8127 r9383 14 14 #include <qframe.h> 15 15 #include <qgl.h> 16 #include <qpainterpath.h> 16 17 17 18 class QwtPlot; … … 19 20 /*! 20 21 \brief An alternative canvas for a QwtPlot derived from QGLWidget 21 22 22 23 QwtPlotGLCanvas implements the very basics to act as canvas 23 24 inside of a QwtPlot widget. It might be extended to a full … … 31 32 32 33 \note With Qt4 you might want to use the QPaintEngine::OpenGL paint engine 33 ( see QGL::setPreferredPaintEngine() ). On a Linux test system 34 ( see QGL::setPreferredPaintEngine() ). On a Linux test system 34 35 QPaintEngine::OpenGL2 shows very basic problems like translated 35 36 geometries. … … 77 78 to use QFrame::Shadow instead. 78 79 79 \note QFrame::StyledPanel and QFrame::WinPanel are unsup orted80 \note QFrame::StyledPanel and QFrame::WinPanel are unsupported 80 81 and will be displayed as QFrame::Panel. 81 82 */ -
trunk/BNC/qwt/qwt_plot_grid.h
r8127 r9383 40 40 virtual int rtti() const; 41 41 42 void enableX( bool tf);42 void enableX( bool ); 43 43 bool xEnabled() const; 44 44 45 void enableY( bool tf);45 void enableY( bool ); 46 46 bool yEnabled() const; 47 47 48 void enableXMin( bool tf);48 void enableXMin( bool ); 49 49 bool xMinEnabled() const; 50 50 51 void enableYMin( bool tf);51 void enableYMin( bool ); 52 52 bool yMinEnabled() const; 53 53 54 void setXDiv( const QwtScaleDiv & sx);54 void setXDiv( const QwtScaleDiv & ); 55 55 const QwtScaleDiv &xScaleDiv() const; 56 56 57 void setYDiv( const QwtScaleDiv & sy);57 void setYDiv( const QwtScaleDiv & ); 58 58 const QwtScaleDiv &yScaleDiv() const; 59 59 … … 66 66 67 67 void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine ); 68 void setMinorPen( const QPen & p);68 void setMinorPen( const QPen & ); 69 69 const QPen& minorPen() const; 70 70 71 virtual void draw( QPainter * p,71 virtual void draw( QPainter *, 72 72 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 73 const QRectF & rect ) const;73 const QRectF &canvasRect ) const; 74 74 75 virtual void updateScaleDiv( 76 const QwtScaleDiv &x Map, const QwtScaleDiv &yMap);75 virtual void updateScaleDiv( 76 const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv ); 77 77 78 78 private: 79 void drawLines( QPainter * painter, const QRectF &,80 Qt::Orientation orientation, const QwtScaleMap &,79 void drawLines( QPainter *, const QRectF &, 80 Qt::Orientation, const QwtScaleMap &, 81 81 const QList<double> & ) const; 82 82 -
trunk/BNC/qwt/qwt_plot_histogram.cpp
r8127 r9383 123 123 /*! 124 124 Build and assign a pen 125 125 126 126 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 127 127 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 128 128 to hide this incompatibility. 129 129 130 130 \param color Pen color 131 131 \param width Pen width 132 132 \param style Pen style 133 133 134 134 \sa pen(), brush() 135 135 */ 136 136 void QwtPlotHistogram::setPen( const QColor &color, qreal width, Qt::PenStyle style ) 137 { 137 { 138 138 setPen( QPen( color, width, style ) ); 139 } 139 } 140 140 141 141 /*! … … 304 304 /*! 305 305 Assign a series of samples 306 306 307 307 setSamples() is just a wrapper for setData() without any additional 308 308 value - beside that it is easier to find for the developer. 309 309 310 310 \param data Data 311 311 \warning The item takes ownership of the data object, deleting 312 312 it when its not used anymore. 313 313 */ 314 void QwtPlotHistogram::setSamples( 314 void QwtPlotHistogram::setSamples( 315 315 QwtSeriesData<QwtIntervalSample> *data ) 316 316 { … … 333 333 void QwtPlotHistogram::drawSeries( QPainter *painter, 334 334 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 335 const QRectF &, int from, int to ) const 336 { 335 const QRectF &canvasRect, int from, int to ) const 336 { 337 Q_UNUSED( canvasRect ) 338 337 339 if ( !painter || dataSize() <= 0 ) 338 340 return; … … 676 678 A plain rectangle without pen using the brush() 677 679 678 \param index Index of the legend entry 680 \param index Index of the legend entry 679 681 ( ignored as there is only one ) 680 682 \param size Icon size 681 683 \return A graphic displaying the icon 682 684 683 685 \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData() 684 686 */ -
trunk/BNC/qwt/qwt_plot_histogram.h
r8127 r9383 37 37 */ 38 38 39 class QWT_EXPORT QwtPlotHistogram: 39 class QWT_EXPORT QwtPlotHistogram: 40 40 public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample> 41 41 { … … 59 59 /*! 60 60 Draw a column for each interval. When a symbol() has been set 61 the symbol is used otherwise the column is displayed as 61 the symbol is used otherwise the column is displayed as 62 62 plain rectangle using pen() and brush(). 63 63 */ … … 77 77 }; 78 78 79 explicit QwtPlotHistogram( const QString &title = QString ::null);79 explicit QwtPlotHistogram( const QString &title = QString() ); 80 80 explicit QwtPlotHistogram( const QwtText &title ); 81 81 virtual ~QwtPlotHistogram(); … … 93 93 void setSamples( QwtSeriesData<QwtIntervalSample> * ); 94 94 95 void setBaseline( double reference);95 void setBaseline( double ); 96 96 double baseline() const; 97 97 … … 102 102 const QwtColumnSymbol *symbol() const; 103 103 104 virtual void drawSeries( QPainter * p,104 virtual void drawSeries( QPainter *, 105 105 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 106 106 const QRectF &canvasRect, int from, int to ) const; -
trunk/BNC/qwt/qwt_plot_intervalcurve.cpp
r8127 r9383 154 154 /*! 155 155 Assign a series of samples 156 156 157 157 setSamples() is just a wrapper for setData() without any additional 158 158 value - beside that it is easier to find for the developer. 159 159 160 160 \param data Data 161 161 \warning The item takes ownership of the data object, deleting 162 162 it when its not used anymore. 163 163 */ 164 void QwtPlotIntervalCurve::setSamples( 164 void QwtPlotIntervalCurve::setSamples( 165 165 QwtSeriesData<QwtIntervalSample> *data ) 166 166 { … … 223 223 /*! 224 224 Build and assign a pen 225 225 226 226 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 227 227 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 228 228 to hide this incompatibility. 229 229 230 230 \param color Pen color 231 231 \param width Pen width 232 232 \param style Pen style 233 233 234 234 \sa pen(), brush() 235 235 */ 236 236 void QwtPlotIntervalCurve::setPen( const QColor &color, qreal width, Qt::PenStyle style ) 237 { 237 { 238 238 setPen( QPen( color, width, style ) ); 239 } 239 } 240 240 241 241 /*! … … 299 299 { 300 300 QRectF rect = QwtPlotSeriesItem::boundingRect(); 301 if ( rect.isValid() &&orientation() == Qt::Vertical )301 if ( orientation() == Qt::Vertical ) 302 302 rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() ); 303 303 … … 546 546 If a symbol is assigned it is scaled to size. 547 547 548 \param index Index of the legend entry 548 \param index Index of the legend entry 549 549 ( ignored as there is only one ) 550 550 \param size Icon size 551 551 552 552 \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData() 553 553 */ 554 QwtGraphic QwtPlotIntervalCurve::legendIcon( 554 QwtGraphic QwtPlotIntervalCurve::legendIcon( 555 555 int index, const QSizeF &size ) const 556 556 { -
trunk/BNC/qwt/qwt_plot_intervalcurve.h
r8127 r9383 25 25 to display error bars or the area between 2 curves. 26 26 */ 27 class QWT_EXPORT QwtPlotIntervalCurve: 27 class QWT_EXPORT QwtPlotIntervalCurve: 28 28 public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample> 29 29 { … … 77 77 typedef QFlags<PaintAttribute> PaintAttributes; 78 78 79 explicit QwtPlotIntervalCurve( const QString &title = QString ::null);79 explicit QwtPlotIntervalCurve( const QString &title = QString() ); 80 80 explicit QwtPlotIntervalCurve( const QwtText &title ); 81 81 … … 103 103 const QwtIntervalSymbol *symbol() const; 104 104 105 virtual void drawSeries( QPainter * p,105 virtual void drawSeries( QPainter *, 106 106 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 107 107 const QRectF &canvasRect, int from, int to ) const; -
trunk/BNC/qwt/qwt_plot_item.cpp
r8127 r9383 95 95 96 96 /*! 97 \brief This method detaches a QwtPlotItem from any 97 \brief This method detaches a QwtPlotItem from any 98 98 QwtPlot it has been associated with. 99 99 … … 305 305 306 306 /*! 307 On multi core systems rendering of certain plot item 308 ( f.e QwtPlotRasterItem ) can be done in parallel in 307 On multi core systems rendering of certain plot item 308 ( f.e QwtPlotRasterItem ) can be done in parallel in 309 309 several threads. 310 310 … … 363 363 The default implementation returns an invalid icon 364 364 365 \param index Index of the legend entry 365 \param index Index of the legend entry 366 366 ( usually there is only one ) 367 367 \param size Icon size … … 369 369 \sa setLegendIconSize(), legendData() 370 370 */ 371 QwtGraphic QwtPlotItem::legendIcon( 371 QwtGraphic QwtPlotItem::legendIcon( 372 372 int index, const QSizeF &size ) const 373 373 { … … 389 389 \return A filled rectangle 390 390 */ 391 QwtGraphic QwtPlotItem::defaultIcon( 391 QwtGraphic QwtPlotItem::defaultIcon( 392 392 const QBrush &brush, const QSizeF &size ) const 393 { 393 { 394 394 QwtGraphic icon; 395 395 if ( !size.isEmpty() ) 396 396 { 397 397 icon.setDefaultSize( size ); 398 398 399 399 QRectF r( 0, 0, size.width(), size.height() ); 400 400 401 401 QPainter painter( &icon ); 402 402 painter.fillRect( r, brush ); 403 } 404 403 } 404 405 405 return icon; 406 } 406 } 407 407 408 408 //! Show the item … … 558 558 \param bottom Returns the bottom margin 559 559 560 \returnThe default implementation returns 0 for all margins560 The default implementation returns 0 for all margins 561 561 562 562 \sa QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins() 563 563 */ 564 void QwtPlotItem::getCanvasMarginHint( const QwtScaleMap &xMap, 564 void QwtPlotItem::getCanvasMarginHint( const QwtScaleMap &xMap, 565 565 const QwtScaleMap &yMap, const QRectF &canvasRect, 566 566 double &left, double &top, double &right, double &bottom ) const … … 583 583 584 584 QwtLegendData is basically a list of QVariants that makes it 585 possible to overload and reimplement legendData() to 585 possible to overload and reimplement legendData() to 586 586 return almost any type of information, that is understood 587 587 by the receiver that acts as the legend. 588 588 589 The default implementation returns one entry with 589 The default implementation returns one entry with 590 590 the title() of the item and the legendIcon(). 591 591 … … 599 599 QwtText label = title(); 600 600 label.setRenderFlags( label.renderFlags() & Qt::AlignLeft ); 601 601 602 602 QVariant titleValue; 603 603 qVariantSetValue( titleValue, label ); 604 604 data.setValue( QwtLegendData::TitleRole, titleValue ); 605 605 606 606 const QwtGraphic graphic = legendIcon( 0, legendIconSize() ); 607 607 if ( !graphic.isNull() ) 608 { 608 { 609 609 QVariant iconValue; 610 610 qVariantSetValue( iconValue, graphic ); 611 611 data.setValue( QwtLegendData::IconRole, iconValue ); 612 } 613 612 } 613 614 614 QList<QwtLegendData> list; 615 615 list += data; … … 659 659 legendData() and legendIcon() 660 660 */ 661 void QwtPlotItem::updateLegend( const QwtPlotItem *item, 661 void QwtPlotItem::updateLegend( const QwtPlotItem *item, 662 662 const QList<QwtLegendData> &data ) 663 663 { -
trunk/BNC/qwt/qwt_plot_item.h
r8127 r9383 124 124 Rtti_PlotZone, 125 125 126 /*! 126 /*! 127 127 Values >= Rtti_PlotUserItem are reserved for plot items 128 128 not implemented in the Qwt library. … … 135 135 136 136 Various aspects of a plot widget depend on the attributes of 137 the attached plot items. If and how a single plot item 137 the attached plot items. If and how a single plot item 138 138 participates in these updates depends on its attributes. 139 139 140 140 \sa setItemAttribute(), testItemAttribute(), ItemInterest 141 141 */ … … 154 154 /*! 155 155 The item needs extra space to display something outside 156 its bounding rectangle. 156 its bounding rectangle. 157 157 \sa getCanvasMarginHint() 158 158 */ … … 175 175 enum ItemInterest 176 176 { 177 /*! 177 /*! 178 178 The item is interested in updates of the scales 179 179 \sa updateScaleDiv() … … 181 181 ScaleInterest = 0x01, 182 182 183 /*! 183 /*! 184 184 The item is interested in updates of the legend ( of other items ) 185 185 This flag is intended for items, that want to implement a legend … … 269 269 virtual QRectF boundingRect() const; 270 270 271 virtual void getCanvasMarginHint( 271 virtual void getCanvasMarginHint( 272 272 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 273 const QRectF &canvas Size,273 const QRectF &canvasRect, 274 274 double &left, double &top, double &right, double &bottom) const; 275 275 276 virtual void updateScaleDiv( 276 virtual void updateScaleDiv( 277 277 const QwtScaleDiv&, const QwtScaleDiv& ); 278 278 -
trunk/BNC/qwt/qwt_plot_layout.cpp
r8127 r9383 164 164 // canvas 165 165 166 plot->canvas()->getContentsMargins( 167 &canvas.contentsMargins[ QwtPlot::yLeft ], 166 plot->canvas()->getContentsMargins( 167 &canvas.contentsMargins[ QwtPlot::yLeft ], 168 168 &canvas.contentsMargins[ QwtPlot::xTop ], 169 169 &canvas.contentsMargins[ QwtPlot::yRight ], … … 845 845 \param dimTitle Expanded height of the title widget 846 846 \param dimFooter Expanded height of the footer widget 847 \param dimAx is Expanded heights of the axis in axis orientation.847 \param dimAxes Expanded heights of the axis in axis orientation. 848 848 849 849 \sa Options 850 850 */ 851 851 void QwtPlotLayout::expandLineBreaks( Options options, const QRectF &rect, 852 int &dimTitle, int &dimFooter, int dimAx is[QwtPlot::axisCnt] ) const852 int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) const 853 853 { 854 854 dimTitle = dimFooter = 0; 855 855 for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ ) 856 dimAx is[axis] = 0;856 dimAxes[axis] = 0; 857 857 858 858 int backboneOffset[QwtPlot::axisCnt]; … … 889 889 { 890 890 // center to the canvas 891 w -= dimAx is[QwtPlot::yLeft] + dimAxis[QwtPlot::yRight];891 w -= dimAxes[QwtPlot::yLeft] + dimAxes[QwtPlot::yRight]; 892 892 } 893 893 … … 912 912 { 913 913 // center to the canvas 914 w -= dimAx is[QwtPlot::yLeft] + dimAxis[QwtPlot::yRight];914 w -= dimAxes[QwtPlot::yLeft] + dimAxes[QwtPlot::yRight]; 915 915 } 916 916 … … 936 936 if ( axis == QwtPlot::xTop || axis == QwtPlot::xBottom ) 937 937 { 938 length = rect.width() - dimAx is[QwtPlot::yLeft]939 - dimAx is[QwtPlot::yRight];938 length = rect.width() - dimAxes[QwtPlot::yLeft] 939 - dimAxes[QwtPlot::yRight]; 940 940 length -= scaleData.start + scaleData.end; 941 941 942 if ( dimAx is[QwtPlot::yRight] > 0 )942 if ( dimAxes[QwtPlot::yRight] > 0 ) 943 943 length -= 1; 944 944 945 length += qMin( dimAx is[QwtPlot::yLeft],945 length += qMin( dimAxes[QwtPlot::yLeft], 946 946 scaleData.start - backboneOffset[QwtPlot::yLeft] ); 947 length += qMin( dimAx is[QwtPlot::yRight],947 length += qMin( dimAxes[QwtPlot::yRight], 948 948 scaleData.end - backboneOffset[QwtPlot::yRight] ); 949 949 } 950 950 else // QwtPlot::yLeft, QwtPlot::yRight 951 951 { 952 length = rect.height() - dimAx is[QwtPlot::xTop]953 - dimAx is[QwtPlot::xBottom];952 length = rect.height() - dimAxes[QwtPlot::xTop] 953 - dimAxes[QwtPlot::xBottom]; 954 954 length -= scaleData.start + scaleData.end; 955 955 length -= 1; 956 956 957 if ( dimAx is[QwtPlot::xBottom] <= 0 )957 if ( dimAxes[QwtPlot::xBottom] <= 0 ) 958 958 length -= 1; 959 if ( dimAx is[QwtPlot::xTop] <= 0 )959 if ( dimAxes[QwtPlot::xTop] <= 0 ) 960 960 length -= 1; 961 961 962 if ( dimAx is[QwtPlot::xBottom] > 0 )962 if ( dimAxes[QwtPlot::xBottom] > 0 ) 963 963 { 964 964 length += qMin( … … 966 966 double( scaleData.start - backboneOffset[QwtPlot::xBottom] ) ); 967 967 } 968 if ( dimAx is[QwtPlot::xTop] > 0 )968 if ( dimAxes[QwtPlot::xTop] > 0 ) 969 969 { 970 970 length += qMin( … … 984 984 985 985 986 if ( d > dimAx is[axis] )987 { 988 dimAx is[axis] = d;986 if ( d > dimAxes[axis] ) 987 { 988 dimAxes[axis] = d; 989 989 done = false; 990 990 } … … 1020 1020 if ( !( options & IgnoreFrames ) ) 1021 1021 { 1022 backboneOffset[axis] += 1022 backboneOffset[axis] += 1023 1023 d_data->layoutData.canvas.contentsMargins[axis]; 1024 1024 } … … 1089 1089 const double cRight = canvasRect.right(); // qreal -> double 1090 1090 canvasRect.setRight( qMin( cRight, axisRect.right() + dx ) ); 1091 } 1091 } 1092 1092 1093 1093 const double maxRight = rightScaleRect.right(); -
trunk/BNC/qwt/qwt_plot_layout.h
r8127 r9383 42 42 IgnoreScrollbars = 0x02, 43 43 44 //! Ignore all frames. 44 //! Ignore all frames. 45 45 IgnoreFrames = 0x04, 46 46 … … 62 62 63 63 void setCanvasMargin( int margin, int axis = -1 ); 64 int canvasMargin( int axis ) const;64 int canvasMargin( int axisId ) const; 65 65 66 66 void setAlignCanvasToScales( bool ); … … 82 82 83 83 virtual void activate( const QwtPlot *, 84 const QRectF & rect, Options options = 0x00);84 const QRectF &plotRect, Options options = Options() ); 85 85 86 86 virtual void invalidate(); -
trunk/BNC/qwt/qwt_plot_legenditem.cpp
r8127 r9383 49 49 }; 50 50 51 QwtLegendLayoutItem::QwtLegendLayoutItem( 51 QwtLegendLayoutItem::QwtLegendLayoutItem( 52 52 const QwtPlotLegendItem *legendItem, const QwtPlotItem *plotItem ): 53 53 d_legendItem( legendItem ), … … 167 167 }; 168 168 169 //! Constructor 169 //! Constructor 170 170 QwtPlotLegendItem::QwtPlotLegendItem(): 171 171 QwtPlotItem( QwtText( "Legend" ) ) … … 194 194 195 195 Alignment means the position of the legend relative 196 to the geometry of the plot canvas. 196 to the geometry of the plot canvas. 197 197 198 198 \param alignment Alignment flags … … 200 200 \sa alignment(), setMaxColumns() 201 201 202 \note To align a legend with many items horizontally 202 \note To align a legend with many items horizontally 203 203 the number of columns need to be limited 204 204 */ … … 262 262 if ( margin != this->margin() ) 263 263 { 264 d_data->layout->setContentsMargins( 264 d_data->layout->setContentsMargins( 265 265 margin, margin, margin, margin ); 266 266 … … 418 418 /*! 419 419 Set the radius for the border 420 420 421 421 \param radius A value <= 0 defines a rectangular border 422 422 \sa borderRadius(), setBorderPen() … … 495 495 \brief Set the background mode 496 496 497 Depending on the mode the complete legend or each item 497 Depending on the mode the complete legend or each item 498 498 might have an background. 499 499 … … 511 511 } 512 512 513 /*! 513 /*! 514 514 \return backgroundMode 515 515 \sa setBackgroundMode(), backgroundBrush(), drawBackground() … … 568 568 if ( d_data->backgroundMode == QwtPlotLegendItem::LegendBackground ) 569 569 drawBackground( painter, d_data->layout->geometry() ); 570 570 571 571 for ( int i = 0; i < d_data->layout->count(); i++ ) 572 572 { 573 const QwtLegendLayoutItem *layoutItem = 573 const QwtLegendLayoutItem *layoutItem = 574 574 static_cast<QwtLegendLayoutItem *>( d_data->layout->itemAt( i ) ); 575 575 … … 595 595 setBackgroundBrush(), setBackgroundMode() 596 596 */ 597 void QwtPlotLegendItem::drawBackground( 597 void QwtPlotLegendItem::drawBackground( 598 598 QPainter *painter, const QRectF &rect ) const 599 599 { … … 602 602 painter->setPen( d_data->borderPen ); 603 603 painter->setBrush( d_data->backgroundBrush ); 604 604 605 605 const double radius = d_data->borderRadius; 606 606 painter->drawRoundedRect( rect, radius, radius ); 607 607 608 608 painter->restore(); 609 609 } … … 624 624 { 625 625 int x = qRound( canvasRect.center().x() ); 626 rect.moveCenter( QPoint( x, rect.center().y() ) ); 626 rect.moveCenter( QPoint( x, rect.center().y() ) ); 627 627 } 628 628 else if ( d_data->alignment & Qt::AlignRight ) … … 630 630 rect.moveRight( qFloor( canvasRect.right() - margin ) ); 631 631 } 632 else 632 else 633 633 { 634 634 rect.moveLeft( qCeil( canvasRect.left() + margin ) ); … … 644 644 rect.moveBottom( qFloor( canvasRect.bottom() - margin ) ); 645 645 } 646 else 647 { 648 rect.moveTop( qCeil( canvasRect.top() + margin ) ); 646 else 647 { 648 rect.moveTop( qCeil( canvasRect.top() + margin ) ); 649 649 } 650 650 … … 653 653 654 654 /*! 655 Update the legend items according to modifications of a 655 Update the legend items according to modifications of a 656 656 plot item 657 657 … … 667 667 QList<QwtLegendLayoutItem *> layoutItems; 668 668 669 QMap<const QwtPlotItem *, QList<QwtLegendLayoutItem *> >::iterator it = 669 QMap<const QwtPlotItem *, QList<QwtLegendLayoutItem *> >::iterator it = 670 670 d_data->map.find( plotItem ); 671 671 if ( it != d_data->map.end() ) … … 692 692 for ( int i = 0; i < data.size(); i++ ) 693 693 { 694 QwtLegendLayoutItem *layoutItem = 694 QwtLegendLayoutItem *layoutItem = 695 695 new QwtLegendLayoutItem( this, plotItem ); 696 696 d_data->layout->addItem( layoutItem ); … … 741 741 */ 742 742 void QwtPlotLegendItem::drawLegendData( QPainter *painter, 743 const QwtPlotItem *plotItem, const QwtLegendData &data, 743 const QwtPlotItem *plotItem, const QwtLegendData &data, 744 744 const QRectF &rect ) const 745 745 { … … 758 758 QRectF iconRect( r.topLeft(), graphic.defaultSize() ); 759 759 760 iconRect.moveCenter( 760 iconRect.moveCenter( 761 761 QPoint( iconRect.center().x(), rect.center().y() ) ); 762 762 … … 822 822 \param width Width 823 823 */ 824 int QwtPlotLegendItem::heightForWidth( 824 int QwtPlotLegendItem::heightForWidth( 825 825 const QwtLegendData &data, int width ) const 826 826 { … … 842 842 } 843 843 844 /*! 844 /*! 845 845 \return All plot items with an entry on the legend 846 846 \note A plot item might have more than one entry on the legend … … 855 855 \note Usually a plot item has only one entry on the legend 856 856 */ 857 QList< QRect > QwtPlotLegendItem::legendGeometries( 857 QList< QRect > QwtPlotLegendItem::legendGeometries( 858 858 const QwtPlotItem *plotItem ) const 859 859 { -
trunk/BNC/qwt/qwt_plot_legenditem.h
r8127 r9383 24 24 to have more space for the plot canvas. 25 25 26 In opposite to QwtLegend the legend item is not interactive. 26 In opposite to QwtLegend the legend item is not interactive. 27 27 To identify mouse clicks on a legend item an event filter 28 28 needs to be installed catching mouse events ob the plot canvas. 29 29 The geometries of the legend items are available using 30 30 legendGeometries(). 31 32 The legend item is aligned to plot canvas according to 31 32 The legend item is aligned to plot canvas according to 33 33 its alignment() flags. It might have a background for the 34 34 complete legend ( usually semi transparent ) or for 35 35 each legend item. 36 36 37 \note An external QwtLegend with a transparent background 38 on top the plot canvas might be another option 37 \note An external QwtLegend with a transparent background 38 on top the plot canvas might be another option 39 39 with a similar effect. 40 40 */ … … 46 46 \brief Background mode 47 47 48 Depending on the mode the complete legend or each item 48 Depending on the mode the complete legend or each item 49 49 might have an background. 50 50 … … 84 84 void setItemSpacing( int ); 85 85 int itemSpacing() const; 86 86 87 87 void setFont( const QFont& ); 88 88 QFont font() const; 89 89 90 void setBorderDistance( int numPixels);90 void setBorderDistance( int ); 91 91 int borderDistance() const; 92 92 … … 106 106 QPen textPen() const; 107 107 108 virtual void draw( QPainter * p,108 virtual void draw( QPainter *, 109 109 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 110 const QRectF & rect ) const;110 const QRectF &canvasRect ) const; 111 111 112 112 void clearLegend(); … … 118 118 119 119 virtual QSize minimumSize( const QwtLegendData & ) const; 120 virtual int heightForWidth( const QwtLegendData &, int w ) const;120 virtual int heightForWidth( const QwtLegendData &, int width ) const; 121 121 122 122 QList< const QwtPlotItem * > plotItems() const; … … 124 124 125 125 protected: 126 virtual void drawLegendData( QPainter *painter, 126 virtual void drawLegendData( QPainter *painter, 127 127 const QwtPlotItem *, const QwtLegendData &, const QRectF & ) const; 128 128 -
trunk/BNC/qwt/qwt_plot_marker.cpp
r8127 r9383 135 135 const QRectF &canvasRect ) const 136 136 { 137 const QPointF pos( xMap.transform( d_data->xValue ), 137 const QPointF pos( xMap.transform( d_data->xValue ), 138 138 yMap.transform( d_data->yValue ) ); 139 139 … … 148 148 const QSizeF sz = d_data->symbol->size(); 149 149 150 const QRectF clipRect = canvasRect.adjusted( 150 const QRectF clipRect = canvasRect.adjusted( 151 151 -sz.width(), -sz.height(), sz.width(), sz.height() ); 152 152 … … 338 338 /*! 339 339 \brief Set the line style 340 \param style Line style. 340 \param style Line style. 341 341 \sa lineStyle() 342 342 */ … … 424 424 In all other styles the alignment is relative to the marker's position. 425 425 426 \param align Alignment. 426 \param align Alignment. 427 427 \sa labelAlignment(), labelOrientation() 428 428 */ … … 503 503 } 504 504 505 /*! 505 /*! 506 506 Build and assign a line pen 507 507 508 508 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 509 509 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 510 510 to hide this incompatibility. 511 511 512 512 \param color Pen color 513 513 \param width Pen width 514 514 \param style Pen style 515 515 516 516 \sa pen(), brush() 517 */ 517 */ 518 518 void QwtPlotMarker::setLinePen( const QColor &color, qreal width, Qt::PenStyle style ) 519 { 519 { 520 520 setLinePen( QPen( color, width, style ) ); 521 521 } … … 549 549 QRectF QwtPlotMarker::boundingRect() const 550 550 { 551 return QRectF( d_data->xValue, d_data->yValue, 0.0, 0.0 ); 551 // width/height of -1 does not affect the autoscale calculation 552 553 switch (d_data->style) 554 { 555 case QwtPlotMarker::HLine: 556 return QRectF( d_data->xValue, d_data->yValue, -1.0, 0.0 ); 557 558 case QwtPlotMarker::VLine: 559 return QRectF( d_data->xValue, d_data->yValue, 0.0, -1.0 ); 560 561 default : 562 return QRectF( d_data->xValue, d_data->yValue, 0.0, 0.0 ); 563 } 552 564 } 553 565 … … 555 567 \return Icon representing the marker on the legend 556 568 557 \param index Index of the legend entry 569 \param index Index of the legend entry 558 570 ( usually there is only one ) 559 571 \param size Icon size … … 586 598 const double y = 0.5 * size.height(); 587 599 588 QwtPainter::drawLine( &painter, 600 QwtPainter::drawLine( &painter, 589 601 0.0, y, size.width(), y ); 590 602 } … … 595 607 const double x = 0.5 * size.width(); 596 608 597 QwtPainter::drawLine( &painter, 609 QwtPainter::drawLine( &painter, 598 610 x, 0.0, x, size.height() ); 599 611 } -
trunk/BNC/qwt/qwt_plot_marker.h
r8127 r9383 38 38 line style. The alignment refers to the center point of 39 39 the marker, which means, for example, that the label would be printed 40 left above the center point if the alignment was set to 40 left above the center point if the alignment was set to 41 41 Qt::AlignLeft | Qt::AlignTop. 42 42 43 43 \note QwtPlotTextLabel is intended to align a text label 44 according to the geometry of canvas 44 according to the geometry of canvas 45 45 ( unrelated to plot coordinates ) 46 46 */ … … 69 69 }; 70 70 71 explicit QwtPlotMarker( const QString &title = QString ::null);71 explicit QwtPlotMarker( const QString &title = QString() ); 72 72 explicit QwtPlotMarker( const QwtText &title ); 73 73 … … 85 85 void setValue( const QPointF & ); 86 86 87 void setLineStyle( LineStyle st);87 void setLineStyle( LineStyle ); 88 88 LineStyle lineStyle() const; 89 89 90 90 void setLinePen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine ); 91 void setLinePen( const QPen & p);91 void setLinePen( const QPen & ); 92 92 const QPen &linePen() const; 93 93 … … 107 107 int spacing() const; 108 108 109 virtual void draw( QPainter * p,109 virtual void draw( QPainter *, 110 110 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 111 111 const QRectF & ) const; … … 116 116 117 117 protected: 118 virtual void drawLines( QPainter *, 118 virtual void drawLines( QPainter *, 119 119 const QRectF &, const QPointF & ) const; 120 120 121 virtual void drawLabel( QPainter *, 121 virtual void drawLabel( QPainter *, 122 122 const QRectF &, const QPointF & ) const; 123 123 -
trunk/BNC/qwt/qwt_plot_multi_barchart.cpp
r8127 r9383 109 109 /*! 110 110 Assign a series of samples 111 111 112 112 setSamples() is just a wrapper for setData() without any additional 113 113 value - beside that it is easier to find for the developer. 114 114 115 115 \param data Data 116 116 \warning The item takes ownership of the data object, deleting 117 117 it when its not used anymore. 118 */ 119 void QwtPlotMultiBarChart::setSamples( 118 */ 119 void QwtPlotMultiBarChart::setSamples( 120 120 QwtSeriesData<QwtSetSample> *data ) 121 { 121 { 122 122 setData( data ); 123 } 123 } 124 124 125 125 /*! … … 138 138 } 139 139 140 /*! 140 /*! 141 141 \return Bar titles 142 142 \sa setBarTitles(), legendData() … … 163 163 return; 164 164 165 QMap<int, QwtColumnSymbol *>::iterator it = 165 QMap<int, QwtColumnSymbol *>::iterator it = 166 166 d_data->symbolMap.find(valueIndex); 167 167 if ( it == d_data->symbolMap.end() ) … … 207 207 { 208 208 QMap<int, QwtColumnSymbol *>::const_iterator it = 209 d_data->symbolMap. find( valueIndex );210 211 return ( it == d_data->symbolMap. end() ) ? NULL : it.value();209 d_data->symbolMap.constFind( valueIndex ); 210 211 return ( it == d_data->symbolMap.constEnd() ) ? NULL : it.value(); 212 212 } 213 213 … … 220 220 \sa setSymbol(), specialSymbol(), drawBar() 221 221 */ 222 QwtColumnSymbol *QwtPlotMultiBarChart::symbol( int valueIndex ) 223 { 224 QMap<int, QwtColumnSymbol *>:: iterator it =225 d_data->symbolMap. find( valueIndex );226 227 return ( it == d_data->symbolMap. end() ) ? NULL : it.value();222 QwtColumnSymbol *QwtPlotMultiBarChart::symbol( int valueIndex ) 223 { 224 QMap<int, QwtColumnSymbol *>::const_iterator it = 225 d_data->symbolMap.constFind( valueIndex ); 226 227 return ( it == d_data->symbolMap.constEnd() ) ? NULL : it.value(); 228 228 } 229 229 … … 233 233 void QwtPlotMultiBarChart::resetSymbolMap() 234 234 { 235 for ( QMap<int, QwtColumnSymbol *>::iterator it 236 = d_data->symbolMap.begin(); it != d_data->symbolMap.end(); ++it ) 237 { 238 delete it.value(); 239 } 240 235 qDeleteAll( d_data->symbolMap ); 241 236 d_data->symbolMap.clear(); 242 237 } … … 253 248 254 249 When no symbol ( NULL ) is returned, the value will be displayed 255 with the standard symbol that is used for all symbols with the same 250 with the standard symbol that is used for all symbols with the same 256 251 valueIndex. 257 252 … … 260 255 261 256 \return NULL, meaning that the value is not special 262 257 263 258 */ 264 QwtColumnSymbol *QwtPlotMultiBarChart::specialSymbol( 259 QwtColumnSymbol *QwtPlotMultiBarChart::specialSymbol( 265 260 int sampleIndex, int valueIndex ) const 266 261 { … … 456 451 \param index Index of the sample to be painted 457 452 \param sampleWidth Boundng width for all bars of the smaple 458 \param sample Sample 453 \param sample Sample 459 454 460 455 \sa drawSeries(), sampleWidth() … … 536 531 \param index Index of the sample to be painted 537 532 \param sampleWidth Width of the bars 538 \param sample Sample 533 \param sample Sample 539 534 540 535 \sa drawSeries(), sampleWidth() … … 542 537 void QwtPlotMultiBarChart::drawStackedBars( QPainter *painter, 543 538 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 544 const QRectF &canvasRect, int index, 539 const QRectF &canvasRect, int index, 545 540 double sampleWidth, const QwtSetSample& sample ) const 546 541 { … … 568 563 double sum = baseline(); 569 564 570 const int numBars = sample.set.size();571 565 for ( int i = 0; i < numBars; i++ ) 572 566 { … … 670 664 { 671 665 // we build a temporary default symbol 672 QwtColumnSymbol sym( QwtColumnSymbol::Box );673 sym.setLineWidth( 1 );674 sym.setFrameStyle( QwtColumnSymbol::Plain );675 sym.draw( painter, rect );666 QwtColumnSymbol columnSymbol( QwtColumnSymbol::Box ); 667 columnSymbol.setLineWidth( 1 ); 668 columnSymbol.setFrameStyle( QwtColumnSymbol::Plain ); 669 columnSymbol.draw( painter, rect ); 676 670 } 677 671 … … 702 696 { 703 697 QVariant iconValue; 704 qVariantSetValue( iconValue, 698 qVariantSetValue( iconValue, 705 699 legendIcon( i, legendIconSize() ) ); 706 700 … … 719 713 \param index Index of the bar 720 714 \param size Icon size 721 715 722 716 \return An icon showing a bar 723 717 \sa drawBar(), legendData() -
trunk/BNC/qwt/qwt_plot_multi_barchart.h
r8127 r9383 20 20 /*! 21 21 \brief QwtPlotMultiBarChart displays a series of a samples that consist 22 each of a set of values. 22 each of a set of values. 23 23 24 Each value is displayed as a bar, the bars of each set can be organized 24 Each value is displayed as a bar, the bars of each set can be organized 25 25 side by side or accumulated. 26 26 … … 29 29 by overloading specialSymbol() or overloading drawBar(). 30 30 31 Depending on its orientation() the bars are displayed horizontally 32 or vertically. The bars cover the interval between the baseline() 31 Depending on its orientation() the bars are displayed horizontally 32 or vertically. The bars cover the interval between the baseline() 33 33 and the value. 34 34 35 35 In opposite to most other plot items, QwtPlotMultiBarChart returns more 36 36 than one entry for the legend - one for each symbol. 37 37 38 38 \sa QwtPlotBarChart, QwtPlotHistogram 39 39 QwtPlotSeriesItem::orientation(), QwtPlotAbstractBarChart::baseline() 40 40 */ 41 class QWT_EXPORT QwtPlotMultiBarChart: 41 class QWT_EXPORT QwtPlotMultiBarChart: 42 42 public QwtPlotAbstractBarChart, public QwtSeriesStore<QwtSetSample> 43 43 { … … 62 62 }; 63 63 64 explicit QwtPlotMultiBarChart( const QString &title = QString ::null);64 explicit QwtPlotMultiBarChart( const QString &title = QString() ); 65 65 explicit QwtPlotMultiBarChart( const QwtText &title ); 66 66 … … 79 79 ChartStyle style() const; 80 80 81 void setSymbol( int barIndex, QwtColumnSymbol *symbol);82 const QwtColumnSymbol *symbol( int barIndex ) const;81 void setSymbol( int valueIndex, QwtColumnSymbol * ); 82 const QwtColumnSymbol *symbol( int valueIndex ) const; 83 83 84 84 void resetSymbolMap(); … … 95 95 96 96 protected: 97 QwtColumnSymbol *symbol( int barIndex );97 QwtColumnSymbol *symbol( int valueIndex ); 98 98 99 virtual QwtColumnSymbol *specialSymbol( 99 virtual QwtColumnSymbol *specialSymbol( 100 100 int sampleIndex, int valueIndex ) const; 101 101 … … 106 106 107 107 virtual void drawBar( QPainter *, int sampleIndex, 108 int barIndex, const QwtColumnRect & ) const;108 int valueIndex, const QwtColumnRect & ) const; 109 109 110 110 void drawStackedBars( QPainter *painter, -
trunk/BNC/qwt/qwt_plot_panner.cpp
r8127 r9383 15 15 #include <qstyle.h> 16 16 #include <qstyleoption.h> 17 #include <qpainterpath.h> 18 19 #if QT_VERSION >= 0x050000 20 #if QT_VERSION < 0x050100 21 #define QWT_USE_WINDOW_HANDLE 1 22 #endif 23 #endif 24 25 #ifdef QWT_USE_WINDOW_HANDLE 26 #include <qwindow.h> 27 #endif 17 28 18 29 static QBitmap qwtBorderMask( const QWidget *canvas, const QSize &size ) 19 30 { 31 #if QT_VERSION >= 0x050000 32 qreal pixelRatio = 1.0; 33 34 #ifdef QWT_USE_WINDOW_HANDLE 35 pixelRatio = canvas->windowHandle()->devicePixelRatio(); 36 #else 37 pixelRatio = canvas->devicePixelRatio(); 38 #endif 39 #endif 40 20 41 const QRect r( 0, 0, size.width(), size.height() ); 21 42 22 43 QPainterPath borderPath; 23 44 24 ( void )QMetaObject::invokeMethod( 45 ( void )QMetaObject::invokeMethod( 25 46 const_cast< QWidget *>( canvas ), "borderPath", Qt::DirectConnection, 26 47 Q_RETURN_ARG( QPainterPath, borderPath ), Q_ARG( QRect, r ) ); … … 31 52 return QBitmap(); 32 53 54 #if QT_VERSION >= 0x050000 55 QBitmap mask( size * pixelRatio ); 56 mask.setDevicePixelRatio( pixelRatio ); 57 #else 33 58 QBitmap mask( size ); 59 #endif 34 60 mask.fill( Qt::color0 ); 35 61 … … 40 66 } 41 67 68 #if QT_VERSION >= 0x050000 69 QImage image( size * pixelRatio, QImage::Format_ARGB32_Premultiplied ); 70 image.setDevicePixelRatio( pixelRatio ); 71 #else 42 72 QImage image( size, QImage::Format_ARGB32_Premultiplied ); 73 #endif 43 74 image.fill( Qt::color0 ); 44 75 … … 63 94 const QVariant frameWidth = canvas->property( "frameWidth" ); 64 95 65 if ( borderRadius.type() == QVariant::Double 96 if ( borderRadius.type() == QVariant::Double 66 97 && frameWidth.type() == QVariant::Int ) 67 98 { 68 99 const double br = borderRadius.toDouble(); 69 100 const int fw = frameWidth.toInt(); 70 101 71 102 if ( br > 0.0 && fw > 0 ) 72 103 { … … 114 145 d_data = new PrivateData(); 115 146 116 connect( this, SIGNAL( panned( int, int )),117 SLOT( moveCanvas( int, int )) );147 connect( this, SIGNAL(panned(int,int)), 148 SLOT(moveCanvas(int,int)) ); 118 149 } 119 150 … … 256 287 */ 257 288 QPixmap QwtPlotPanner::grab() const 258 { 289 { 259 290 const QWidget *cv = canvas(); 260 291 if ( cv && cv->inherits( "QGLWidget" ) ) … … 272 303 273 304 return QwtPanner::grab(); 274 } 275 305 } 306 -
trunk/BNC/qwt/qwt_plot_picker.cpp
r8127 r9383 193 193 QwtText QwtPlotPicker::trackerText( const QPoint &pos ) const 194 194 { 195 if ( plot() == NULL ) 196 return QwtText(); 197 195 198 return trackerTextF( invTransform( pos ) ); 196 199 } -
trunk/BNC/qwt/qwt_plot_rasteritem.cpp
r8127 r9383 159 159 py0 += strippedRect.top() - paintRect.top(); 160 160 161 QImage expanded(sz, image.format()); 161 QImage expanded( sz, image.format() ); 162 if ( image.format() == QImage::Format_Indexed8 ) 163 expanded.setColorTable( image.colorTable() ); 162 164 163 165 switch( image.depth() ) … … 191 193 } 192 194 193 const quint32 *line1 = 195 const quint32 *line1 = 194 196 reinterpret_cast<const quint32 *>( image.scanLine( y1 ) ); 195 197 … … 223 225 for ( int y2 = yy1; y2 < yy2; y2++ ) 224 226 { 225 quint32 *line2 = reinterpret_cast<quint32 *>( 227 quint32 *line2 = reinterpret_cast<quint32 *>( 226 228 expanded.scanLine( y2 ) ); 227 229 228 for ( int x2 = xx1; x2 < xx2; x2++ ) 230 for ( int x2 = xx1; x2 < xx2; x2++ ) 229 231 line2[x2] = rgb; 230 } 231 } 232 } 232 } 233 } 234 } 233 235 break; 234 236 } … … 241 243 { 242 244 yy1 = 0; 243 } 245 } 244 246 else 245 247 { 246 248 yy1 = qRound( y1 * ph - py0 ); 247 249 if ( yy1 < 0 ) 248 yy1 = 0; 249 } 250 250 yy1 = 0; 251 } 252 251 253 int yy2; 252 254 if ( y1 == h - 1 ) 253 255 { 254 256 yy2 = sz.height(); 255 } 257 } 256 258 else 257 259 { … … 260 262 yy2 = sz.height(); 261 263 } 262 264 263 265 const uchar *line1 = image.scanLine( y1 ); 264 266 … … 293 295 uchar *line2 = expanded.scanLine( y2 ); 294 296 memset( line2 + xx1, line1[x1], xx2 - xx1 ); 295 } 296 } 297 } 298 } 297 299 } 298 300 break; … … 301 303 expanded = image; 302 304 } 303 305 304 306 return expanded; 305 } 307 } 306 308 307 309 static QRectF qwtExpandToPixels(const QRectF &rect, const QRectF &pixelRect) … … 385 387 } 386 388 387 static void qwtToRgba( const QImage* from, QImage* to, 389 static void qwtToRgba( const QImage* from, QImage* to, 388 390 const QRect& tile, int alpha ) 389 391 { … … 573 575 574 576 The geometry of a pixel is used to calculated the resolution and 575 alignment of the rendered image. 576 577 Width and height of the hint need to be the horizontal 578 and vertical distances between 2 neighbored points. 579 The center of the hint has to be the position of any point 577 alignment of the rendered image. 578 579 Width and height of the hint need to be the horizontal 580 and vertical distances between 2 neighbored points. 581 The center of the hint has to be the position of any point 580 582 ( it doesn't matter which one ). 581 583 582 584 Limiting the resolution of the image might significantly improve 583 585 the performance and heavily reduce the amount of memory when rendering 584 a QImage from the raster data. 586 a QImage from the raster data. 585 587 586 588 The default implementation returns an empty rectangle (QRectF()), … … 664 666 { 665 667 /* 666 If only one dimension is of the data pixel is higher 668 If only one dimension is of the data pixel is higher 667 669 we expand the pixel rect to the resolution of the target device. 668 670 */ … … 690 692 // data pixels we render in resolution of the paint device. 691 693 692 image = compose(xxMap, yyMap, 694 image = compose(xxMap, yyMap, 693 695 area, paintRect, paintRect.size().toSize(), doCache); 694 696 if ( image.isNull() ) … … 698 700 // excluded in the intervals 699 701 700 imageRect = qwtStripRect(paintRect, area, 702 imageRect = qwtStripRect(paintRect, area, 701 703 xxMap, yyMap, xInterval, yInterval); 702 704 703 705 if ( imageRect != paintRect ) 704 706 { 705 const QRect r( 707 const QRect r( 706 708 qRound( imageRect.x() - paintRect.x()), 707 709 qRound( imageRect.y() - paintRect.y() ), 708 710 qRound( imageRect.width() ), 709 711 qRound( imageRect.height() ) ); 710 712 711 713 image = image.copy(r); 712 } 714 } 713 715 } 714 716 else … … 735 737 imageSize.setHeight( qRound( imageArea.height() / pixelRect.height() ) ); 736 738 737 image = compose(xxMap, yyMap, 739 image = compose(xxMap, yyMap, 738 740 imageArea, paintRect, imageSize, doCache ); 739 741 … … 741 743 return; 742 744 743 imageRect = qwtStripRect(paintRect, area, 745 imageRect = qwtStripRect(paintRect, area, 744 746 xxMap, yyMap, xInterval, yInterval); 745 747 … … 747 749 testPaintAttribute( PaintInDeviceResolution ) ) 748 750 { 749 // Because of rounding errors the pixels 750 // need to be expanded manually to rectangles of 751 // Because of rounding errors the pixels 752 // need to be expanded manually to rectangles of 751 753 // different sizes 752 754 753 image = qwtExpandImage(image, xxMap, yyMap, 755 image = qwtExpandImage(image, xxMap, yyMap, 754 756 imageArea, area, paintRect, xInterval, yInterval ); 755 757 } … … 758 760 painter->save(); 759 761 painter->setWorldTransform( QTransform() ); 760 762 761 763 QwtPainter::drawImage( painter, imageRect, image ); 762 764 … … 769 771 This method is intended to be reimplemented by derived classes. 770 772 The default implementation returns an invalid interval. 771 773 772 774 \param axis X, Y, or Z axis 773 775 */ … … 817 819 } 818 820 819 QImage QwtPlotRasterItem::compose( 821 QImage QwtPlotRasterItem::compose( 820 822 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 821 const QRectF &imageArea, const QRectF &paintRect, 823 const QRectF &imageArea, const QRectF &paintRect, 822 824 const QSize &imageSize, bool doCache) const 823 825 { … … 842 844 dx = imageArea.width() / imageSize.width(); 843 845 844 const QwtScaleMap xxMap = 846 const QwtScaleMap xxMap = 845 847 imageMap(Qt::Horizontal, xMap, imageArea, imageSize, dx); 846 848 847 849 double dy = 0.0; 848 850 if ( paintRect.toRect().height() > imageSize.height() ) 849 851 dy = imageArea.height() / imageSize.height(); 850 852 851 const QwtScaleMap yyMap = 853 const QwtScaleMap yyMap = 852 854 imageMap(Qt::Vertical, yMap, imageArea, imageSize, dy); 853 855 … … 937 939 } 938 940 939 if ( pixelSize > 0.0 )941 if ( pixelSize > 0.0 || p2 == 1.0 ) 940 942 { 941 943 double off = 0.5 * pixelSize; -
trunk/BNC/qwt/qwt_plot_rasteritem.h
r8127 r9383 51 51 /*! 52 52 renderImage() is called, whenever the image cache is not valid, 53 or the scales, or the size of the canvas has changed. 53 or the scales, or the size of the canvas has changed. 54 54 55 This type of cache is useful for improving the performance 56 of hide/show operations or manipulations of the alpha value. 55 This type of cache is useful for improving the performance 56 of hide/show operations or manipulations of the alpha value. 57 57 All other situations are handled by the canvas backing store. 58 58 */ … … 69 69 When the image is rendered according to the data pixels 70 70 ( QwtRasterData::pixelHint() ) it can be expanded to paint 71 device resolution before it is passed to QPainter. 72 The expansion algorithm rounds the pixel borders in the same 71 device resolution before it is passed to QPainter. 72 The expansion algorithm rounds the pixel borders in the same 73 73 way as the axis ticks, what is usually better than the 74 74 scaling algorithm implemented in Qt. 75 Disabling this flag might make sense, to reduce the size of a 75 Disabling this flag might make sense, to reduce the size of a 76 76 document/file. If this is possible for a document format 77 77 depends on the implementation of the specific QPaintEngine. … … 84 84 typedef QFlags<PaintAttribute> PaintAttributes; 85 85 86 explicit QwtPlotRasterItem( const QString& title = QString ::null);86 explicit QwtPlotRasterItem( const QString& title = QString() ); 87 87 explicit QwtPlotRasterItem( const QwtText& title ); 88 88 virtual ~QwtPlotRasterItem(); … … 99 99 void invalidateCache(); 100 100 101 virtual void draw( QPainter * p,101 virtual void draw( QPainter *, 102 102 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 103 const QRectF & rect ) const;103 const QRectF &canvasRect ) const; 104 104 105 105 virtual QRectF pixelHint( const QRectF & ) const; … … 110 110 protected: 111 111 /*! 112 \brief Render an image 112 \brief Render an image 113 113 114 114 An implementation of render() might iterate over all 115 pixels of imageRect. Each pixel has to be translated into 115 pixels of imageRect. Each pixel has to be translated into 116 116 the corresponding position in scale coordinates using the maps. 117 117 This position can be used to look up a value in a implementation … … 122 122 \param area Requested area for the image in scale coordinates 123 123 \param imageSize Requested size of the image 124 124 125 125 \return Rendered image 126 126 */ -
trunk/BNC/qwt/qwt_plot_renderer.cpp
r8127 r9383 15 15 #include "qwt_scale_widget.h" 16 16 #include "qwt_scale_engine.h" 17 #include "qwt_scale_map.h" 17 18 #include "qwt_text.h" 18 19 #include "qwt_text_label.h" 19 20 #include "qwt_math.h" 21 20 22 #include <qpainter.h> 21 #include <qpainte ngine.h>23 #include <qpainterpath.h> 22 24 #include <qtransform.h> 23 25 #include <qprinter.h> 24 #include <qprintdialog.h>25 26 #include <qfiledialog.h> 26 27 #include <qfileinfo.h> 27 #include <qstyle.h>28 #include <qstyleoption.h>29 28 #include <qimagewriter.h> 29 #include <qvariant.h> 30 30 31 #ifndef QWT_NO_SVG 31 32 #ifdef QT_SVG_LIB 33 #if QT_VERSION >= 0x040500 34 #define QWT_FORMAT_SVG 1 35 #endif 36 #endif 37 #endif 38 39 #ifndef QT_NO_PRINTER 40 #define QWT_FORMAT_PDF 1 41 #endif 42 43 #ifndef QT_NO_PDF 44 45 // QPdfWriter::setResolution() has been introduced with 46 // Qt 5.3. Guess it is o.k. to stay with QPrinter for older 47 // versions. 48 49 #if QT_VERSION >= 0x050300 50 51 #ifndef QWT_FORMAT_PDF 52 #define QWT_FORMAT_PDF 1 53 #endif 54 55 #define QWT_PDF_WRITER 1 56 57 #endif 58 #endif 59 60 #ifndef QT_NO_PRINTER 61 // postscript support has been dropped in Qt5 62 #if QT_VERSION < 0x050000 63 #define QWT_FORMAT_POSTSCRIPT 1 64 #endif 65 #endif 66 67 #if QWT_FORMAT_SVG 32 68 #include <qsvggenerator.h> 33 69 #endif 34 #endif 35 36 static QPainterPath qwtCanvasClip( 70 71 #if QWT_PDF_WRITER 72 #include <qpdfwriter.h> 73 #endif 74 75 static QPainterPath qwtCanvasClip( 37 76 const QWidget* canvas, const QRectF &canvasRect ) 38 77 { … … 58 97 } 59 98 99 static inline QFont qwtResolvedFont( const QWidget *widget ) 100 { 101 QFont font = widget->font(); 102 font.resolve( QFont::AllPropertiesResolved ); 103 104 return font; 105 } 106 60 107 class QwtPlotRenderer::PrivateData 61 108 { … … 71 118 }; 72 119 73 /*! 120 /*! 74 121 Constructor 75 122 \param parent Parent object … … 239 286 240 287 const QString fmt = format.toLower(); 241 if ( fmt == "pdf" ) 242 { 243 #ifndef QT_NO_PRINTER 288 if ( fmt == QLatin1String( "pdf" ) ) 289 { 290 #if QWT_FORMAT_PDF 291 292 #if QWT_PDF_WRITER 293 QPdfWriter pdfWriter( fileName ); 294 pdfWriter.setPageSizeMM( sizeMM ); 295 pdfWriter.setTitle( title ); 296 pdfWriter.setPageMargins( QMarginsF() ); 297 pdfWriter.setResolution( resolution ); 298 299 QPainter painter( &pdfWriter ); 300 render( plot, &painter, documentRect ); 301 #else 244 302 QPrinter printer; 245 303 printer.setOutputFormat( QPrinter::PdfFormat ); … … 254 312 render( plot, &painter, documentRect ); 255 313 #endif 256 } 257 else if ( fmt == "ps" )258 {259 #if QT_VERSION < 0x050000 260 #if ndef QT_NO_PRINTER314 #endif 315 } 316 else if ( fmt == QLatin1String( "ps" ) ) 317 { 318 #if QWT_FORMAT_POSTSCRIPT 261 319 QPrinter printer; 262 320 printer.setOutputFormat( QPrinter::PostScriptFormat ); … … 271 329 render( plot, &painter, documentRect ); 272 330 #endif 273 #endif 274 } 275 else if ( fmt == "svg" ) 276 { 277 #ifndef QWT_NO_SVG 278 #ifdef QT_SVG_LIB 279 #if QT_VERSION >= 0x040500 331 } 332 else if ( fmt == QLatin1String( "svg" ) ) 333 { 334 #if QWT_FORMAT_SVG 280 335 QSvgGenerator generator; 281 336 generator.setTitle( title ); … … 287 342 render( plot, &painter, documentRect ); 288 343 #endif 289 #endif290 #endif291 344 } 292 345 else … … 367 420 #endif 368 421 369 #ifndef QWT_NO_SVG 370 #ifdef QT_SVG_LIB 371 #if QT_VERSION >= 0x040500 422 #if QWT_FORMAT_SVG 372 423 373 424 /*! … … 395 446 render( plot, &p, rect ); 396 447 } 397 #endif 398 #endif 448 399 449 #endif 400 450 … … 461 511 if ( !plot->axisEnabled( axisId ) ) 462 512 { 463 int left = 0;464 int right = 0;465 int top = 0;466 int bottom = 0;467 468 513 // When we have a scale the frame is painted on 469 514 // the position of the backbone - otherwise we … … 487 532 break; 488 533 } 489 layoutRect.adjust( left, top, right, bottom );490 534 } 491 535 } … … 500 544 { 501 545 layoutOptions |= QwtPlotLayout::IgnoreFrames; 502 } 503 546 } 504 547 505 548 if ( d_data->discardFlags & DiscardLegend ) … … 591 634 \param plot Plot widget 592 635 \param painter Painter 593 \param rect Bounding rectangle636 \param titleRect Bounding rectangle for the title 594 637 */ 595 638 void QwtPlotRenderer::renderTitle( const QwtPlot *plot, 596 QPainter *painter, const QRectF & rect ) const597 { 598 painter->setFont( plot->titleLabel()->font() );639 QPainter *painter, const QRectF &titleRect ) const 640 { 641 painter->setFont( qwtResolvedFont( plot->titleLabel() ) ); 599 642 600 643 const QColor color = plot->titleLabel()->palette().color( … … 602 645 603 646 painter->setPen( color ); 604 plot->titleLabel()->text().draw( painter, rect );647 plot->titleLabel()->text().draw( painter, titleRect ); 605 648 } 606 649 … … 610 653 \param plot Plot widget 611 654 \param painter Painter 612 \param rect Bounding rectangle655 \param footerRect Bounding rectangle for the footer 613 656 */ 614 657 void QwtPlotRenderer::renderFooter( const QwtPlot *plot, 615 QPainter *painter, const QRectF & rect ) const616 { 617 painter->setFont( plot->footerLabel()->font() );658 QPainter *painter, const QRectF &footerRect ) const 659 { 660 painter->setFont( qwtResolvedFont( plot->footerLabel() ) ); 618 661 619 662 const QColor color = plot->footerLabel()->palette().color( … … 621 664 622 665 painter->setPen( color ); 623 plot->footerLabel()->text().draw( painter, rect ); 624 } 625 666 plot->footerLabel()->text().draw( painter, footerRect ); 667 } 626 668 627 669 /*! … … 630 672 \param plot Plot widget 631 673 \param painter Painter 632 \param rect Bounding rectangle674 \param legendRect Bounding rectangle for the legend 633 675 */ 634 676 void QwtPlotRenderer::renderLegend( const QwtPlot *plot, 635 QPainter *painter, const QRectF & rect ) const677 QPainter *painter, const QRectF &legendRect ) const 636 678 { 637 679 if ( plot->legend() ) 638 680 { 639 681 bool fillBackground = !( d_data->discardFlags & DiscardBackground ); 640 plot->legend()->renderLegend( painter, rect, fillBackground );682 plot->legend()->renderLegend( painter, legendRect, fillBackground ); 641 683 } 642 684 } … … 652 694 \param endDist End border distance 653 695 \param baseDist Base distance 654 \param rect Bounding rectangle696 \param scaleRect Bounding rectangle for the scale 655 697 */ 656 698 void QwtPlotRenderer::renderScale( const QwtPlot *plot, 657 699 QPainter *painter, 658 700 int axisId, int startDist, int endDist, int baseDist, 659 const QRectF & rect ) const701 const QRectF &scaleRect ) const 660 702 { 661 703 if ( !plot->axisEnabled( axisId ) ) … … 666 708 && scaleWidget->colorBarWidth() > 0 ) 667 709 { 668 scaleWidget->drawColorBar( painter, scaleWidget->colorBarRect( rect ) );710 scaleWidget->drawColorBar( painter, scaleWidget->colorBarRect( scaleRect ) ); 669 711 baseDist += scaleWidget->colorBarWidth() + scaleWidget->spacing(); 670 712 } … … 679 721 case QwtPlot::yLeft: 680 722 { 681 x = rect.right() - 1.0 - baseDist;682 y = rect.y() + startDist;683 w = rect.height() - startDist - endDist;723 x = scaleRect.right() - 1.0 - baseDist; 724 y = scaleRect.y() + startDist; 725 w = scaleRect.height() - startDist - endDist; 684 726 align = QwtScaleDraw::LeftScale; 685 727 break; … … 687 729 case QwtPlot::yRight: 688 730 { 689 x = rect.left() + baseDist;690 y = rect.y() + startDist;691 w = rect.height() - startDist - endDist;731 x = scaleRect.left() + baseDist; 732 y = scaleRect.y() + startDist; 733 w = scaleRect.height() - startDist - endDist; 692 734 align = QwtScaleDraw::RightScale; 693 735 break; … … 695 737 case QwtPlot::xTop: 696 738 { 697 x = rect.left() + startDist;698 y = rect.bottom() - 1.0 - baseDist;699 w = rect.width() - startDist - endDist;739 x = scaleRect.left() + startDist; 740 y = scaleRect.bottom() - 1.0 - baseDist; 741 w = scaleRect.width() - startDist - endDist; 700 742 align = QwtScaleDraw::TopScale; 701 743 break; … … 703 745 case QwtPlot::xBottom: 704 746 { 705 x = rect.left() + startDist;706 y = rect.top() + baseDist;707 w = rect.width() - startDist - endDist;747 x = scaleRect.left() + startDist; 748 y = scaleRect.top() + baseDist; 749 w = scaleRect.width() - startDist - endDist; 708 750 align = QwtScaleDraw::BottomScale; 709 751 break; … … 713 755 } 714 756 715 scaleWidget->drawTitle( painter, align, rect );716 717 painter->setFont( scaleWidget->font() );757 scaleWidget->drawTitle( painter, align, scaleRect ); 758 759 painter->setFont( qwtResolvedFont( scaleWidget ) ); 718 760 719 761 QwtScaleDraw *sd = const_cast<QwtScaleDraw *>( scaleWidget->scaleDraw() ); … … 740 782 \param plot Plot widget 741 783 \param painter Painter 742 \param map Maps mapping between plot and paint device coordinates784 \param maps Maps mapping between plot and paint device coordinates 743 785 \param canvasRect Canvas rectangle 744 786 */ 745 787 void QwtPlotRenderer::renderCanvas( const QwtPlot *plot, 746 QPainter *painter, const QRectF &canvasRect, 747 const QwtScaleMap *map ) const788 QPainter *painter, const QRectF &canvasRect, 789 const QwtScaleMap *maps ) const 748 790 { 749 791 const QWidget *canvas = plot->canvas(); … … 771 813 772 814 painter->setClipRect( canvasRect ); 773 plot->drawItems( painter, canvasRect, map );815 plot->drawItems( painter, canvasRect, maps ); 774 816 775 817 painter->restore(); … … 795 837 painter->setClipPath( clipPath ); 796 838 797 plot->drawItems( painter, canvasRect, map );839 plot->drawItems( painter, canvasRect, maps ); 798 840 799 841 painter->restore(); … … 814 856 } 815 857 816 QRectF innerRect = canvasRect.adjusted( 858 QRectF innerRect = canvasRect.adjusted( 817 859 frameWidth, frameWidth, -frameWidth, -frameWidth ); 818 860 … … 833 875 } 834 876 835 plot->drawItems( painter, innerRect, map );877 plot->drawItems( painter, innerRect, maps ); 836 878 837 879 painter->restore(); … … 845 887 canvas->property( "frameShape" ).toInt(); 846 888 847 const int frameWidth = canvas->property( "frameWidth" ).toInt();848 849 850 889 const QVariant borderRadius = canvas->property( "borderRadius" ); 851 if ( borderRadius.type() == QVariant::Double 890 if ( borderRadius.type() == QVariant::Double 852 891 && borderRadius.toDouble() > 0.0 ) 853 892 { 854 const double r = borderRadius.toDouble();893 const double radius = borderRadius.toDouble(); 855 894 856 895 QwtPainter::drawRoundedFrame( painter, canvasRect, 857 r , r, canvas->palette(), frameWidth, frameStyle );896 radius, radius, canvas->palette(), frameWidth, frameStyle ); 858 897 } 859 898 else … … 933 972 double margins[QwtPlot::axisCnt]; 934 973 plot->getCanvasMarginsHint( maps, canvasRect, 935 margins[QwtPlot::yLeft], margins[QwtPlot::xTop], 974 margins[QwtPlot::yLeft], margins[QwtPlot::xTop], 936 975 margins[QwtPlot::yRight], margins[QwtPlot::xBottom] ); 937 976 … … 963 1002 bool QwtPlotRenderer::exportTo( QwtPlot *plot, const QString &documentName, 964 1003 const QSizeF &sizeMM, int resolution ) 965 { 1004 { 966 1005 if ( plot == NULL ) 967 1006 return false; 968 1007 969 1008 QString fileName = documentName; 970 1009 971 // What about translation 1010 // What about translation 972 1011 973 1012 #ifndef QT_NO_FILEDIALOG 974 1013 const QList<QByteArray> imageFormats = 975 1014 QImageWriter::supportedImageFormats(); 976 1015 977 1016 QStringList filter; 978 #if ndef QT_NO_PRINTER1017 #if QWT_FORMAT_PDF 979 1018 filter += QString( "PDF " ) + tr( "Documents" ) + " (*.pdf)"; 980 1019 #endif 981 #if ndef QWT_NO_SVG1020 #if QWT_FORMAT_SVG 982 1021 filter += QString( "SVG " ) + tr( "Documents" ) + " (*.svg)"; 983 1022 #endif 984 #if ndef QT_NO_PRINTER1023 #if QWT_FORMAT_POSTSCRIPT 985 1024 filter += QString( "Postscript " ) + tr( "Documents" ) + " (*.ps)"; 986 1025 #endif 987 1026 988 1027 if ( imageFormats.size() > 0 ) 989 1028 { … … 994 1033 if ( i > 0 ) 995 1034 imageFilter += " "; 996 imageFilter += "*."; 1035 imageFilter += "*."; 997 1036 imageFilter += imageFormats[i]; 998 } 1037 } 999 1038 imageFilter += ")"; 1000 1039 1001 1040 filter += imageFilter; 1002 } 1003 1041 } 1042 1004 1043 fileName = QFileDialog::getSaveFileName( 1005 1044 NULL, tr( "Export File Name" ), fileName, 1006 1045 filter.join( ";;" ), NULL, QFileDialog::DontConfirmOverwrite ); 1007 #endif 1046 #endif 1008 1047 if ( fileName.isEmpty() ) 1009 1048 return false; … … 1012 1051 1013 1052 return true; 1014 } 1053 } -
trunk/BNC/qwt/qwt_plot_renderer.h
r8127 r9383 61 61 DiscardFooter = 0x10, 62 62 63 /*! 63 /*! 64 64 Don't render the frame of the canvas 65 65 … … 128 128 #endif 129 129 130 void renderTo( QwtPlot *, QPaintDevice & p) const;130 void renderTo( QwtPlot *, QPaintDevice & ) const; 131 131 132 132 virtual void render( QwtPlot *, 133 QPainter *, const QRectF & rect ) const;133 QPainter *, const QRectF &plotRect ) const; 134 134 135 135 virtual void renderTitle( const QwtPlot *, 136 QPainter *, const QRectF & ) const;136 QPainter *, const QRectF &titleRect ) const; 137 137 138 138 virtual void renderFooter( const QwtPlot *, 139 QPainter *, const QRectF & ) const;139 QPainter *, const QRectF &footerRect ) const; 140 140 141 141 virtual void renderScale( const QwtPlot *, QPainter *, 142 142 int axisId, int startDist, int endDist, 143 int baseDist, const QRectF & ) const;143 int baseDist, const QRectF &scaleRect ) const; 144 144 145 145 virtual void renderCanvas( const QwtPlot *, … … 147 147 const QwtScaleMap* maps ) const; 148 148 149 virtual void renderLegend( 150 const QwtPlot *, QPainter *, const QRectF & ) const;149 virtual void renderLegend( 150 const QwtPlot *, QPainter *, const QRectF &legendRect ) const; 151 151 152 152 bool exportTo( QwtPlot *, const QString &documentName, -
trunk/BNC/qwt/qwt_plot_rescaler.h
r8127 r9383 117 117 118 118 virtual void rescale( const QSize &oldSize, const QSize &newSize ) const; 119 virtual QwtInterval expandScale( 119 virtual QwtInterval expandScale( 120 120 int axis, const QSize &oldSize, const QSize &newSize ) const; 121 121 -
trunk/BNC/qwt/qwt_plot_scaleitem.cpp
r8127 r9383 350 350 if ( d_data->scaleDivFromAxis ) 351 351 { 352 const QwtInterval interval = 352 const QwtInterval interval = 353 353 d_data->scaleInterval( canvasRect, xMap, yMap ); 354 354 … … 448 448 if ( d_data->scaleDivFromAxis && scaleDraw ) 449 449 { 450 const QwtScaleDiv &scaleDiv = 450 const QwtScaleDiv &scaleDiv = 451 451 scaleDraw->orientation() == Qt::Horizontal ? xScaleDiv : yScaleDiv; 452 452 … … 456 456 const QRectF canvasRect = plt->canvas()->contentsRect(); 457 457 458 const QwtInterval interval = d_data->scaleInterval( 458 const QwtInterval interval = d_data->scaleInterval( 459 459 canvasRect, plt->canvasMap( xAxis() ), plt->canvasMap( yAxis() ) ); 460 460 -
trunk/BNC/qwt/qwt_plot_scaleitem.h
r4271 r9383 33 33 34 34 \par Example 35 The following example shows how to replace the left axis, by a scale item 36 at the x position 0.0. 37 \verbatim 38 QwtPlotScaleItem *scaleItem = 39 new QwtPlotScaleItem(QwtScaleDraw::RightScale, 0.0); 40 scaleItem->setFont(plot->axisWidget(QwtPlot::yLeft)->font()); 41 scaleItem->attach(plot); 35 The following example shows how to replace the left axis, by a scale item 36 at the x position 0.0. 37 \code 38 QwtPlotScaleItem *scaleItem = new QwtPlotScaleItem( QwtScaleDraw::RightScale, 0.0 ); 39 scaleItem->setFont( plot->axisWidget( QwtPlot::yLeft )->font() ); 40 scaleItem->attach(plot); 42 41 43 plot->enableAxis(QwtPlot::yLeft, false); 44 \endverbatim 42 plot->enableAxis( QwtPlot::yLeft, false ); 43 \endcode 44 \endpar 45 45 */ 46 46 … … 76 76 double position() const; 77 77 78 void setBorderDistance( int numPixels);78 void setBorderDistance( int ); 79 79 int borderDistance() const; 80 80 81 81 void setAlignment( QwtScaleDraw::Alignment ); 82 82 83 virtual void draw( QPainter * p,83 virtual void draw( QPainter *, 84 84 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 85 const QRectF & rect ) const;85 const QRectF &canvasRect ) const; 86 86 87 87 virtual void updateScaleDiv( const QwtScaleDiv &, const QwtScaleDiv & ); -
trunk/BNC/qwt/qwt_plot_seriesitem.cpp
r8127 r9383 40 40 { 41 41 d_data = new PrivateData(); 42 setItemInterest( QwtPlotItem::ScaleInterest, true ); 42 43 } 43 44 … … 99 100 void QwtPlotSeriesItem::updateScaleDiv( 100 101 const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv ) 101 { 102 { 102 103 const QRectF rect = QRectF( 103 104 xScaleDiv.lowerBound(), yScaleDiv.lowerBound(), 104 105 xScaleDiv.range(), yScaleDiv.range() ); 105 106 106 107 setRectOfInterest( rect ); 107 } 108 } 108 109 109 110 void QwtPlotSeriesItem::dataChanged() -
trunk/BNC/qwt/qwt_plot_seriesitem.h
r8127 r9383 24 24 { 25 25 public: 26 explicit QwtPlotSeriesItem( const QString &title = QString ::null);26 explicit QwtPlotSeriesItem( const QString &title = QString() ); 27 27 explicit QwtPlotSeriesItem( const QwtText &title ); 28 28 … … 32 32 Qt::Orientation orientation() const; 33 33 34 virtual void draw( QPainter * p,34 virtual void draw( QPainter *, 35 35 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 36 36 const QRectF & ) const; … … 53 53 virtual QRectF boundingRect() const; 54 54 55 virtual void updateScaleDiv( 55 virtual void updateScaleDiv( 56 56 const QwtScaleDiv &, const QwtScaleDiv & ); 57 57 -
trunk/BNC/qwt/qwt_plot_shapeitem.cpp
r8127 r9383 208 208 \sa setShape(), setPolygon(), shape() 209 209 */ 210 void QwtPlotShapeItem::setRect( const QRectF &rect ) 210 void QwtPlotShapeItem::setRect( const QRectF &rect ) 211 211 { 212 212 QPainterPath path; … … 263 263 } 264 264 265 /*! 265 /*! 266 266 Build and assign a pen 267 267 268 268 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 269 269 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 270 270 to hide this incompatibility. 271 271 272 272 \param color Pen color 273 273 \param width Pen width 274 274 \param style Pen style 275 275 276 276 \sa pen(), brush() 277 */ 277 */ 278 278 void QwtPlotShapeItem::setPen( const QColor &color, qreal width, Qt::PenStyle style ) 279 { 279 { 280 280 setPen( QPen( color, width, style ) ); 281 281 } … … 336 336 \brief Set the tolerance for the weeding optimization 337 337 338 After translating the shape into target device coordinate 338 After translating the shape into target device coordinate 339 339 ( usually widget geometries ) the painter path can be simplified 340 340 by a point weeding algorithm ( Douglas-Peucker ). … … 384 384 return; 385 385 386 if ( d_data->pen.style() == Qt::NoPen 386 if ( d_data->pen.style() == Qt::NoPen 387 387 && d_data->brush.style() == Qt::NoBrush ) 388 388 { … … 404 404 const bool doAlign = QwtPainter::roundingAlignment( painter ); 405 405 406 QPainterPath path = qwtTransformPath( xMap, yMap, 406 QPainterPath path = qwtTransformPath( xMap, yMap, 407 407 d_data->shape, doAlign ); 408 408 … … 451 451 \return A rectangle filled with the color of the brush ( or the pen ) 452 452 453 \param index Index of the legend entry 453 \param index Index of the legend entry 454 454 ( usually there is only one ) 455 455 \param size Icon size -
trunk/BNC/qwt/qwt_plot_shapeitem.h
r8127 r9383 16 16 17 17 /*! 18 \brief A plot item, which displays any graphical shape, 18 \brief A plot item, which displays any graphical shape, 19 19 that can be defined by a QPainterPath 20 20 … … 61 61 LegendShape, 62 62 63 //! Display a filled rectangle 63 //! Display a filled rectangle 64 64 LegendColor 65 65 }; 66 66 67 explicit QwtPlotShapeItem( const QString &title = QString ::null);67 explicit QwtPlotShapeItem( const QString &title = QString() ); 68 68 explicit QwtPlotShapeItem( const QwtText &title ); 69 69 … … 94 94 virtual QRectF boundingRect() const; 95 95 96 virtual void draw( QPainter * p,96 virtual void draw( QPainter *, 97 97 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 98 const QRectF & rect ) const;98 const QRectF &canvasRect ) const; 99 99 100 100 virtual QwtGraphic legendIcon( int index, const QSizeF & ) const; -
trunk/BNC/qwt/qwt_plot_spectrocurve.cpp
r8127 r9383 118 118 /*! 119 119 Assign a series of samples 120 120 121 121 setSamples() is just a wrapper for setData() without any additional 122 122 value - beside that it is easier to find for the developer. 123 123 124 124 \param data Data 125 125 \warning The item takes ownership of the data object, deleting 126 it when its not used anymore. 126 it when its not used anymore. 127 127 */ 128 128 void QwtPlotSpectroCurve::setSamples( … … 130 130 { 131 131 setData( data ); 132 } 132 } 133 133 134 134 /*! … … 311 311 d_data->colorRange, sample.z() ); 312 312 313 painter->setPen( QPen( QColor::fromRgba( d_data->colorTable[index] ), 313 painter->setPen( QPen( QColor::fromRgba( d_data->colorTable[index] ), 314 314 d_data->penWidth ) ); 315 315 } -
trunk/BNC/qwt/qwt_plot_spectrocurve.h
r8127 r9383 22 22 mapped to a color. 23 23 */ 24 class QWT_EXPORT QwtPlotSpectroCurve: 25 public QwtPlotSeriesItem, QwtSeriesStore<QwtPoint3D>24 class QWT_EXPORT QwtPlotSpectroCurve: 25 public QwtPlotSeriesItem, public QwtSeriesStore<QwtPoint3D> 26 26 { 27 27 public: … … 36 36 typedef QFlags<PaintAttribute> PaintAttributes; 37 37 38 explicit QwtPlotSpectroCurve( const QString &title = QString ::null);38 explicit QwtPlotSpectroCurve( const QString &title = QString() ); 39 39 explicit QwtPlotSpectroCurve( const QwtText &title ); 40 40 … … 60 60 const QRectF &canvasRect, int from, int to ) const; 61 61 62 void setPenWidth( double width);62 void setPenWidth( double ); 63 63 double penWidth() const; 64 64 -
trunk/BNC/qwt/qwt_plot_spectrogram.cpp
r8127 r9383 162 162 } 163 163 164 /*! 164 /*! 165 165 Build and assign the default pen for the contour lines 166 166 167 167 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 168 168 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 169 169 to hide this incompatibility. 170 170 171 171 \param color Pen color 172 172 \param width Pen width 173 173 \param style Pen style 174 174 175 175 \sa pen(), brush() 176 */ 177 void QwtPlotSpectrogram::setDefaultContourPen( 176 */ 177 void QwtPlotSpectrogram::setDefaultContourPen( 178 178 const QColor &color, qreal width, Qt::PenStyle style ) 179 { 179 { 180 180 setDefaultContourPen( QPen( color, width, style ) ); 181 181 } … … 363 363 364 364 The geometry of a pixel is used to calculated the resolution and 365 alignment of the rendered image. 365 alignment of the rendered image. 366 366 367 367 The default implementation returns data()->pixelHint( rect ); … … 372 372 \return Bounding rectangle of a pixel 373 373 374 \sa QwtPlotRasterItem::pixelHint(), QwtRasterData::pixelHint(), 374 \sa QwtPlotRasterItem::pixelHint(), QwtRasterData::pixelHint(), 375 375 render(), renderImage() 376 376 */ … … 403 403 const QRectF &area, const QSize &imageSize ) const 404 404 { 405 if ( imageSize.isEmpty() || d_data->data == NULL 405 if ( imageSize.isEmpty() || d_data->data == NULL 406 406 || d_data->colorMap == NULL ) 407 407 { … … 424 424 425 425 #if DEBUG_RENDER 426 427 426 QElapsedTimer time; 427 time.start(); 428 428 #endif 429 429 … … 547 547 \sa drawContourLines(), QwtRasterData::contourLines() 548 548 */ 549 QSize QwtPlotSpectrogram::contourRasterSize( 549 QSize QwtPlotSpectrogram::contourRasterSize( 550 550 const QRectF &area, const QRect &rect ) const 551 551 { -
trunk/BNC/qwt/qwt_plot_spectrogram.h
r8127 r9383 56 56 typedef QFlags<DisplayMode> DisplayModes; 57 57 58 explicit QwtPlotSpectrogram( const QString &title = QString ::null);58 explicit QwtPlotSpectrogram( const QString &title = QString() ); 59 59 virtual ~QwtPlotSpectrogram(); 60 60 … … 72 72 virtual QRectF pixelHint( const QRectF & ) const; 73 73 74 void setDefaultContourPen( const QColor &, 74 void setDefaultContourPen( const QColor &, 75 75 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine ); 76 76 void setDefaultContourPen( const QPen & ); … … 87 87 virtual int rtti() const; 88 88 89 virtual void draw( QPainter * p,89 virtual void draw( QPainter *, 90 90 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 91 const QRectF & rect ) const;91 const QRectF &canvasRect ) const; 92 92 93 93 protected: … … 102 102 const QRectF &rect, const QSize &raster ) const; 103 103 104 virtual void drawContourLines( QPainter * p,104 virtual void drawContourLines( QPainter *, 105 105 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 106 const QwtRasterData::ContourLines& lines) const;106 const QwtRasterData::ContourLines& ) const; 107 107 108 108 void renderTile( const QwtScaleMap &xMap, const QwtScaleMap &yMap, 109 const QRect & imageRect, QImage *image) const;109 const QRect &tile, QImage * ) const; 110 110 111 111 private: -
trunk/BNC/qwt/qwt_plot_svgitem.h
r8127 r9383 28 28 { 29 29 public: 30 explicit QwtPlotSvgItem( const QString& title = QString ::null);30 explicit QwtPlotSvgItem( const QString& title = QString() ); 31 31 explicit QwtPlotSvgItem( const QwtText& title ); 32 32 virtual ~QwtPlotSvgItem(); … … 37 37 virtual QRectF boundingRect() const; 38 38 39 virtual void draw( QPainter * p,39 virtual void draw( QPainter *, 40 40 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 41 const QRectF & rect ) const;41 const QRectF &canvasRect ) const; 42 42 43 43 virtual int rtti() const; … … 47 47 QSvgRenderer &renderer(); 48 48 49 void render( QPainter * painter,49 void render( QPainter *, 50 50 const QRectF &viewBox, const QRectF &rect ) const; 51 51 52 QRectF viewBox( const QRectF & area) const;52 QRectF viewBox( const QRectF &rect ) const; 53 53 54 54 private: -
trunk/BNC/qwt/qwt_plot_textlabel.cpp
r8127 r9383 16 16 17 17 static QRect qwtItemRect( int renderFlags, 18 const QRectF &rect, const QSizeF &itemSize ) 18 const QRectF &rect, const QSizeF &itemSize ) 19 19 { 20 20 int x; … … 33 33 34 34 int y; 35 if ( renderFlags & Qt::AlignTop ) 35 if ( renderFlags & Qt::AlignTop ) 36 36 { 37 37 y = rect.top(); … … 50 50 51 51 class QwtPlotTextLabel::PrivateData 52 { 52 { 53 53 public: 54 54 PrivateData(): … … 61 61 62 62 QPixmap pixmap; 63 }; 63 }; 64 64 65 65 /*! … … 102 102 103 103 /*! 104 Set the text 104 Set the text 105 105 106 106 The label will be aligned to the plot canvas according to … … 211 211 pw = qMax( d_data->text.borderPen().width(), 1 ); 212 212 213 QRect pixmapRect; 213 QRect pixmapRect; 214 214 pixmapRect.setLeft( qFloor( rect.left() ) - pw ); 215 215 pixmapRect.setTop( qFloor( rect.top() ) - pw ); 216 216 pixmapRect.setRight( qCeil( rect.right() ) + pw ); 217 217 pixmapRect.setBottom( qCeil( rect.bottom() ) + pw ); 218 218 219 219 #define QWT_HIGH_DPI 1 220 220 … … 225 225 const QSize scaledSize = pixmapRect.size(); 226 226 #endif 227 if ( d_data->pixmap.isNull() || 227 if ( d_data->pixmap.isNull() || 228 228 ( scaledSize != d_data->pixmap.size() ) ) 229 229 { … … 234 234 d_data->pixmap.fill( Qt::transparent ); 235 235 236 const QRect r( pw, pw, 236 const QRect r( pw, pw, 237 237 pixmapRect.width() - 2 * pw, pixmapRect.height() - 2 * pw ); 238 238 … … 260 260 \sa setMargin(), QwtText::renderFlags(), QwtText::textSize() 261 261 */ 262 QRectF QwtPlotTextLabel::textRect( 262 QRectF QwtPlotTextLabel::textRect( 263 263 const QRectF &rect, const QSizeF &textSize ) const 264 264 { -
trunk/BNC/qwt/qwt_plot_textlabel.h
r8127 r9383 22 22 In opposite to QwtPlotMarker the position of the label is unrelated to 23 23 plot coordinates. 24 24 25 25 As drawing a text is an expensive operation the label is cached 26 26 in a pixmap to speed up replots. 27 27 28 28 \par Example 29 The following code shows how to add a title. 29 The following code shows how to add a title. 30 \code 31 QwtText title( "Plot Title" ); 32 title.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop ); 30 33 31 \verbatim 32 QwtText title( "Plot Title");33 title.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop);34 QFont font; 35 font.setBold( true ); 36 title.setFont( font ); 34 37 35 QFont font; 36 font.setBold( true ); 37 title.setFont( font ); 38 39 QwtPlotTextLabel *titleItem = new QwtPlotTextLabel(); 40 titleItem->setText( title ); 41 titleItem->attach( this ); 42 \endverbatim 38 QwtPlotTextLabel *titleItem = new QwtPlotTextLabel(); 39 titleItem->setText( title ); 40 titleItem->attach( plot ); 41 \endcode 42 \endpar 43 43 44 44 \sa QwtPlotMarker 45 */ 45 */ 46 46 47 47 class QWT_EXPORT QwtPlotTextLabel: public QwtPlotItem -
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() ); -
trunk/BNC/qwt/qwt_plot_tradingcurve.h
r8127 r9383 22 22 that are used in the domain of technical analysis. 23 23 24 While the length ( height or width depending on orientation() ) 24 While the length ( height or width depending on orientation() ) 25 25 of each symbol depends on the corresponding OHLC sample the size 26 26 of the other dimension can be controlled using: … … 32 32 The extent is a size in scale coordinates, so that the symbol width 33 33 is increasing when the plot is zoomed in. Minimum/Maximum width 34 is in widget coordinates independent from the zoom level. 35 When setting the minimum and maximum to the same value, the width of 36 the symbol is fixed. 34 is in widget coordinates independent from the zoom level. 35 When setting the minimum and maximum to the same value, the width of 36 the symbol is fixed. 37 37 */ 38 class QWT_EXPORT QwtPlotTradingCurve: 39 public QwtPlotSeriesItem, QwtSeriesStore<QwtOHLCSample>38 class QWT_EXPORT QwtPlotTradingCurve: 39 public QwtPlotSeriesItem, public QwtSeriesStore<QwtOHLCSample> 40 40 { 41 41 public: … … 102 102 typedef QFlags<PaintAttribute> PaintAttributes; 103 103 104 explicit QwtPlotTradingCurve( const QString &title = QString ::null);104 explicit QwtPlotTradingCurve( const QString &title = QString() ); 105 105 explicit QwtPlotTradingCurve( const QwtText &title ); 106 106 … … 118 118 SymbolStyle symbolStyle() const; 119 119 120 void setSymbolPen( const QColor &, 120 void setSymbolPen( const QColor &, 121 121 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine ); 122 122 void setSymbolPen( const QPen & ); … … 126 126 QBrush symbolBrush( Direction ) const; 127 127 128 void setSymbolExtent( double width);128 void setSymbolExtent( double ); 129 129 double symbolExtent() const; 130 130 … … 151 151 const QRectF &canvasRect, int from, int to ) const; 152 152 153 virtual void drawUserSymbol( QPainter *, 153 virtual void drawUserSymbol( QPainter *, 154 154 SymbolStyle, const QwtOHLCSample &, 155 Qt::Orientation, bool inverted, double symbolWidth ) const; 156 157 void drawBar( QPainter *painter, const QwtOHLCSample &, 155 158 Qt::Orientation, bool inverted, double width ) const; 156 159 157 void drawBar( QPainter *painter, const QwtOHLCSample &, 158 Qt::Orientation, bool inverted, double width ) const; 159 160 void drawCandleStick( QPainter *, const QwtOHLCSample &, 160 void drawCandleStick( QPainter *, const QwtOHLCSample &, 161 161 Qt::Orientation, double width ) const; 162 162 -
trunk/BNC/qwt/qwt_plot_xml.cpp
r8127 r9383 29 29 from a specific editor in the Qwt designer plugin. 30 30 31 \return QString ::null31 \return QString() 32 32 \warning The plot editor has never been implemented. 33 33 */ … … 38 38 return title().text(); 39 39 #else 40 return QString ::null;40 return QString(); 41 41 #endif 42 42 } -
trunk/BNC/qwt/qwt_plot_zoneitem.cpp
r8127 r9383 14 14 15 15 class QwtPlotZoneItem::PrivateData 16 { 16 { 17 17 public: 18 18 PrivateData(): … … 24 24 brush = QBrush( c ); 25 25 } 26 26 27 27 Qt::Orientation orientation; 28 28 QPen pen; 29 29 QBrush brush; 30 30 QwtInterval interval; 31 }; 31 }; 32 32 33 33 /*! … … 68 68 } 69 69 70 /*! 70 /*! 71 71 Build and assign a pen 72 72 73 73 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 74 74 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 75 75 to hide this incompatibility. 76 76 77 77 \param color Pen color 78 78 \param width Pen width 79 79 \param style Pen style 80 80 81 81 \sa pen(), brush() 82 */ 82 */ 83 83 void QwtPlotZoneItem::setPen( const QColor &color, qreal width, Qt::PenStyle style ) 84 { 84 { 85 85 setPen( QPen( color, width, style ) ); 86 86 } 87 87 88 88 /*! 89 \brief Assign a pen 89 \brief Assign a pen 90 90 91 91 The pen is used to draw the border lines of the zone … … 112 112 } 113 113 114 /*! 115 \brief Assign a brush 116 114 /*! 115 \brief Assign a brush 116 117 117 The brush is used to fill the zone 118 118 … … 141 141 \brief Set the orientation of the zone 142 142 143 A horizontal zone highlights an interval of the y axis, 144 a vertical zone of the x axis. It is unbounded in the 143 A horizontal zone highlights an interval of the y axis, 144 a vertical zone of the x axis. It is unbounded in the 145 145 opposite direction. 146 146 … … 196 196 { 197 197 d_data->interval = interval; 198 itemChanged(); 199 } 200 } 198 itemChanged(); 199 } 200 } 201 201 202 202 /*! … … 207 207 { 208 208 return d_data->interval; 209 } 209 } 210 210 211 211 /*! … … 286 286 } 287 287 288 /*! 288 /*! 289 289 The bounding rectangle is build from the interval in one direction 290 290 and something invalid for the opposite direction. -
trunk/BNC/qwt/qwt_plot_zoneitem.h
r8127 r9383 21 21 \brief A plot item, which displays a zone 22 22 23 A horizontal zone highlights an interval of the y axis - a vertical 23 A horizontal zone highlights an interval of the y axis - a vertical 24 24 zone an interval of the x axis - and is unbounded in the opposite direction. 25 It is filled with a brush and its border lines are optionally displayed with a pen. 25 It is filled with a brush and its border lines are optionally displayed with a pen. 26 26 27 \note For displaying an area that is bounded for x and y coordinates 27 \note For displaying an area that is bounded for x and y coordinates 28 28 use QwtPlotShapeItem 29 29 */ 30 30 31 class QWT_EXPORT QwtPlotZoneItem: 31 class QWT_EXPORT QwtPlotZoneItem: 32 32 public QwtPlotItem 33 33 { -
trunk/BNC/qwt/qwt_plot_zoomer.cpp
r8127 r9383 14 14 #include <qalgorithms.h> 15 15 16 static QwtInterval qwtExpandedZoomInterval( double v1, double v2, 16 static QwtInterval qwtExpandedZoomInterval( double v1, double v2, 17 17 double minRange, const QwtTransform* transform ) 18 18 { -
trunk/BNC/qwt/qwt_plot_zoomer.h
r8127 r9383 23 23 the coordinates of the current mouse position. 24 24 25 Zooming can be repeated as often as possible, limited only by 25 Zooming can be repeated as often as possible, limited only by 26 26 maxStackDepth() or minZoomSize(). Each rectangle is pushed on a stack. 27 27 28 The default setting how to select rectangles is 28 The default setting how to select rectangles is 29 29 a QwtPickerDragRectMachine with the following bindings: 30 30 31 31 - QwtEventPattern::MouseSelect1\n 32 The first point of the zoom rectangle is selected by a mouse press, 32 The first point of the zoom rectangle is selected by a mouse press, 33 33 the second point from the position, where the mouse is released. 34 34 … … 45 45 - QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo\n 46 46 Zoom out one position on the zoom stack 47 47 48 48 - QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo\n 49 49 Zoom in one position on the zoom stack … … 53 53 54 54 The setKeyPattern() and setMousePattern() functions can be used 55 to configure the zoomer actions. The following example 56 shows, how to configure the 'I' and 'O' keys for zooming in and out 57 one position on the zoom stack. The "Home" key is used to 55 to configure the zoomer actions. The following example 56 shows, how to configure the 'I' and 'O' keys for zooming in and out 57 one position on the zoom stack. The "Home" key is used to 58 58 "unzoom" the plot. 59 59 … … 103 103 104 104 public Q_SLOTS: 105 void moveBy( double x, doubley );105 void moveBy( double dx, double dy ); 106 106 virtual void moveTo( const QPointF & ); 107 107 108 108 virtual void zoom( const QRectF & ); 109 virtual void zoom( int up);109 virtual void zoom( int offset ); 110 110 111 111 Q_SIGNALS: -
trunk/BNC/qwt/qwt_point_3d.cpp
r4271 r9383 14 14 QDebug operator<<( QDebug debug, const QwtPoint3D &point ) 15 15 { 16 debug.nospace() << "QwtPoint3D(" << point.x() 16 debug.nospace() << "QwtPoint3D(" << point.x() 17 17 << "," << point.y() << "," << point.z() << ")"; 18 18 return debug.space(); -
trunk/BNC/qwt/qwt_point_data.cpp
r8127 r9383 287 287 interval is calculated from the "rectangle of interest". 288 288 289 \param index Index of the requested point 289 \param index Index of the requested point 290 290 \return Calculated x coordinate 291 291 … … 297 297 d_interval : d_intervalOfInterest; 298 298 299 if ( !interval.isValid() ) 299 if ( !interval.isValid() ) 300 300 return 0.0; 301 301 -
trunk/BNC/qwt/qwt_point_data.h
r8127 r9383 26 26 27 27 virtual size_t size() const; 28 virtual QPointF sample( size_t i ) const;28 virtual QPointF sample( size_t index ) const; 29 29 30 30 const QVector<double> &xData() const; … … 46 46 virtual QRectF boundingRect() const; 47 47 virtual size_t size() const; 48 virtual QPointF sample( size_t i ) const;48 virtual QPointF sample( size_t index ) const; 49 49 50 50 const double *xData() const; … … 123 123 124 124 virtual QRectF boundingRect() const; 125 virtual QPointF sample( size_t i ) const;125 virtual QPointF sample( size_t index ) const; 126 126 127 127 /*! -
trunk/BNC/qwt/qwt_point_mapper.cpp
r8127 r9383 23 23 24 24 #if !defined(QT_NO_QFUTURE) 25 #define QWT_USE_THREADS 025 #define QWT_USE_THREADS 1 26 26 #endif 27 27 … … 43 43 static void qwtRenderDots( 44 44 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 45 const QwtDotsCommand command, const QPoint &pos, QImage *image ) 45 const QwtDotsCommand command, const QPoint &pos, QImage *image ) 46 46 { 47 47 const QRgb rgb = command.rgb; … … 95 95 96 96 struct QwtNoRoundF 97 { 97 { 98 98 inline double operator()( double value ) 99 99 { … … 106 106 107 107 template<class Polygon, class Point, class Round> 108 static inline Polygon qwtToPoints( 108 static inline Polygon qwtToPoints( 109 109 const QRectF &boundingRect, 110 110 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 111 const QwtSeriesData<QPointF> *series, 111 const QwtSeriesData<QPointF> *series, 112 112 int from, int to, Round round ) 113 113 { … … 169 169 int from, int to ) 170 170 { 171 return qwtToPoints<QPolygon, QPoint>( 171 return qwtToPoints<QPolygon, QPoint>( 172 172 boundingRect, xMap, yMap, series, from, to, QwtRoundI() ); 173 173 } … … 180 180 int from, int to, Round round ) 181 181 { 182 return qwtToPoints<QPolygonF, QPointF>( 182 return qwtToPoints<QPolygonF, QPointF>( 183 183 boundingRect, xMap, yMap, series, from, to, round ); 184 184 } … … 188 188 189 189 template<class Polygon, class Point, class Round> 190 static inline Polygon qwtToPolylineFiltered( 191 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 192 const QwtSeriesData<QPointF> *series, 190 static inline Polygon qwtToPolylineFiltered( 191 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 192 const QwtSeriesData<QPointF> *series, 193 193 int from, int to, Round round ) 194 194 { … … 239 239 return qwtToPolylineFiltered<QPolygonF, QPointF>( 240 240 xMap, yMap, series, from, to, round ); 241 } 241 } 242 242 243 243 template<class Polygon, class Point> … … 283 283 return qwtToPointsFiltered<QPolygon, QPoint>( 284 284 boundingRect, xMap, yMap, series, from, to ); 285 } 285 } 286 286 287 287 static inline QPolygonF qwtToPointsFilteredF( … … 390 390 391 391 When the WeedOutPoints flag is enabled consecutive points, 392 that are mapped to the same position will be one point. 392 that are mapped to the same position will be one point. 393 393 394 394 When RoundPoints is set all points are rounded to integers … … 414 414 if ( d_data->flags & RoundPoints ) 415 415 { 416 polyline = qwtToPolylineFilteredF( 416 polyline = qwtToPolylineFilteredF( 417 417 xMap, yMap, series, from, to, QwtRoundF() ); 418 418 } 419 419 else 420 420 { 421 polyline = qwtToPolylineFilteredF( 421 polyline = qwtToPolylineFilteredF( 422 422 xMap, yMap, series, from, to, QwtNoRoundF() ); 423 423 } … … 427 427 if ( d_data->flags & RoundPoints ) 428 428 { 429 polyline = qwtToPointsF( qwtInvalidRect, 429 polyline = qwtToPointsF( qwtInvalidRect, 430 430 xMap, yMap, series, from, to, QwtRoundF() ); 431 431 } 432 432 else 433 433 { 434 polyline = qwtToPointsF( qwtInvalidRect, 434 polyline = qwtToPointsF( qwtInvalidRect, 435 435 xMap, yMap, series, from, to, QwtNoRoundF() ); 436 436 } … … 444 444 445 445 When the WeedOutPoints flag is enabled consecutive points, 446 that are mapped to the same position will be one point. 446 that are mapped to the same position will be one point. 447 447 448 448 \param xMap x map … … 462 462 if ( d_data->flags & WeedOutPoints ) 463 463 { 464 polyline = qwtToPolylineFilteredI( 464 polyline = qwtToPolylineFilteredI( 465 465 xMap, yMap, series, from, to ); 466 466 } 467 467 else 468 468 { 469 polyline = qwtToPointsI( 469 polyline = qwtToPointsI( 470 470 qwtInvalidRect, xMap, yMap, series, from, to ); 471 471 } … … 478 478 479 479 - WeedOutPoints & RoundPoints & boundingRect().isValid() 480 All points that are mapped to the same position 480 All points that are mapped to the same position 481 481 will be one point. Points outside of the bounding 482 482 rectangle are ignored. 483 483 484 484 - WeedOutPoints & RoundPoints & !boundingRect().isValid() 485 All consecutive points that are mapped to the same position 485 All consecutive points that are mapped to the same position 486 486 will one point 487 487 488 - WeedOutPoints & !RoundPoints 489 All consecutive points that are mapped to the same position 488 - WeedOutPoints & !RoundPoints 489 All consecutive points that are mapped to the same position 490 490 will one point 491 491 … … 516 516 { 517 517 if ( d_data->boundingRect.isValid() ) 518 { 518 { 519 519 points = qwtToPointsFilteredF( d_data->boundingRect, 520 520 xMap, yMap, series, from, to ); 521 521 } 522 522 else 523 { 523 { 524 524 // without a bounding rectangle all we can 525 525 // do is to filter out duplicates of 526 526 // consecutive points 527 527 528 points = qwtToPolylineFilteredF( 528 points = qwtToPolylineFilteredF( 529 529 xMap, yMap, series, from, to, QwtRoundF() ); 530 530 } … … 535 535 // qwtToPointsFilteredF 536 536 537 points = qwtToPolylineFilteredF( 537 points = qwtToPolylineFilteredF( 538 538 xMap, yMap, series, from, to, QwtNoRoundF() ); 539 539 } … … 560 560 561 561 - WeedOutPoints & boundingRect().isValid() 562 All points that are mapped to the same position 562 All points that are mapped to the same position 563 563 will be one point. Points outside of the bounding 564 564 rectangle are ignored. 565 565 566 566 - WeedOutPoints & !boundingRect().isValid() 567 All consecutive points that are mapped to the same position 567 All consecutive points that are mapped to the same position 568 568 will one point 569 569 … … 597 597 // we can do is to filter out consecutive duplicates 598 598 599 points = qwtToPolylineFilteredI( 599 points = qwtToPolylineFilteredI( 600 600 xMap, yMap, series, from, to ); 601 601 } … … 603 603 else 604 604 { 605 points = qwtToPointsI( 605 points = qwtToPointsI( 606 606 d_data->boundingRect, xMap, yMap, series, from, to ); 607 607 } … … 631 631 QImage QwtPointMapper::toImage( 632 632 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 633 const QwtSeriesData<QPointF> *series, int from, int to, 633 const QwtSeriesData<QPointF> *series, int from, int to, 634 634 const QPen &pen, bool antialiased, uint numThreads ) const 635 635 { … … 681 681 command.to = index0 + numPoints - 1; 682 682 683 futures += QtConcurrent::run( &qwtRenderDots, 683 futures += QtConcurrent::run( &qwtRenderDots, 684 684 xMap, yMap, command, pos, &image ); 685 685 } -
trunk/BNC/qwt/qwt_point_mapper.h
r8127 r9383 23 23 24 24 QwtPointMapper is a collection of methods and optimizations 25 for translating a series of points into paint device coordinates. 26 It is used by QwtPlotCurve but might also be useful for 25 for translating a series of points into paint device coordinates. 26 It is used by QwtPlotCurve but might also be useful for 27 27 similar plot items displaying a QwtSeriesData<QPointF>. 28 28 */ … … 30 30 { 31 31 public: 32 /*! 32 /*! 33 33 \brief Flags affecting the transformation process 34 34 \sa setFlag(), setFlags() … … 39 39 RoundPoints = 0x01, 40 40 41 /*! 41 /*! 42 42 Try to remove points, that are translated to the 43 43 same position. … … 46 46 }; 47 47 48 /*! 48 /*! 49 49 \brief Flags affecting the transformation process 50 50 \sa setFlag(), setFlags() … … 77 77 78 78 QImage toImage( const QwtScaleMap &xMap, const QwtScaleMap &yMap, 79 const QwtSeriesData<QPointF> *series, int from, int to, 79 const QwtSeriesData<QPointF> *series, int from, int to, 80 80 const QPen &, bool antialiased, uint numThreads ) const; 81 81 -
trunk/BNC/qwt/qwt_point_polar.cpp
r8127 r9383 112 112 QDebug operator<<( QDebug debug, const QwtPointPolar &point ) 113 113 { 114 debug.nospace() << "QwtPointPolar(" 114 debug.nospace() << "QwtPointPolar(" 115 115 << point.azimuth() << "," << point.radius() << ")"; 116 116 -
trunk/BNC/qwt/qwt_point_polar.h
r8127 r9383 31 31 QwtPointPolar(); 32 32 QwtPointPolar( double azimuth, double radius ); 33 QwtPointPolar( const QwtPointPolar & );34 33 QwtPointPolar( const QPointF & ); 35 34 … … 80 79 d_azimuth( azimuth ), 81 80 d_radius( radius ) 82 {83 }84 85 /*!86 Constructs a point using the values of the point specified.87 \param other Other point88 */89 inline QwtPointPolar::QwtPointPolar( const QwtPointPolar &other ):90 d_azimuth( other.d_azimuth ),91 d_radius( other.d_radius )92 81 { 93 82 } … … 191 180 inline QPointF qwtFastDegree2Pos( const QPointF &pole, 192 181 double radius, double angle ) 193 { 182 { 194 183 return qwtFastPolar2Pos( pole, radius, angle / 180.0 * M_PI ); 195 } 184 } 196 185 197 186 inline QwtPointPolar qwtFastPos2Polar( const QPointF &pos ) … … 201 190 } 202 191 203 #endif 192 #endif -
trunk/BNC/qwt/qwt_raster_data.cpp
r8127 r9383 217 217 \brief Pixel hint 218 218 219 pixelHint() returns the geometry of a pixel, that can be used 219 pixelHint() returns the geometry of a pixel, that can be used 220 220 to calculate the resolution and alignment of the plot item, that is 221 representing the data. 222 223 Width and height of the hint need to be the horizontal 224 and vertical distances between 2 neighbored points. 225 The center of the hint has to be the position of any point 221 representing the data. 222 223 Width and height of the hint need to be the horizontal 224 and vertical distances between 2 neighbored points. 225 The center of the hint has to be the position of any point 226 226 ( it doesn't matter which one ). 227 227 … … 230 230 Limiting the resolution of the image might significantly improve 231 231 the performance and heavily reduce the amount of memory when rendering 232 a QImage from the raster data. 232 a QImage from the raster data. 233 233 234 234 The default implementation returns an empty rectangle recommending … … 238 238 depend on the requested area. 239 239 240 \return Bounding rectangle of a pixel 240 \return Bounding rectangle of a pixel 241 241 */ 242 242 QRectF QwtRasterData::pixelHint( const QRectF &area ) const 243 243 { 244 244 Q_UNUSED( area ); 245 return QRectF(); 245 return QRectF(); 246 246 } 247 247 … … 281 281 QwtRasterData *that = const_cast<QwtRasterData *>( this ); 282 282 that->initRaster( rect, raster ); 283 284 #if __GNUC__ >= 9 285 #pragma GCC diagnostic push 286 #pragma GCC diagnostic ignored "-Wdeprecated-copy" 287 #endif 283 288 284 289 for ( int y = 0; y < raster.height() - 1; y++ ) … … 399 404 } 400 405 406 #if __GNUC__ >= 9 407 #pragma GCC diagnostic pop 408 #endif 409 401 410 that->discardRaster(); 402 411 -
trunk/BNC/qwt/qwt_round_scale_draw.cpp
r8127 r9383 185 185 \param painter Painter 186 186 \param value Value of the tick 187 \param len Leng htof the tick187 \param len Length of the tick 188 188 189 189 \sa drawBackbone(), drawLabel() -
trunk/BNC/qwt/qwt_round_scale_draw.h
r8127 r9383 46 46 47 47 protected: 48 virtual void drawTick( QPainter *, double val , double len ) const;48 virtual void drawTick( QPainter *, double value, double len ) const; 49 49 virtual void drawBackbone( QPainter * ) const; 50 50 virtual void drawLabel( QPainter *, double val ) const; -
trunk/BNC/qwt/qwt_sampling_thread.h
r8127 r9383 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 1 10 #ifndef _QWT_SAMPLING_THREAD_H_ 2 11 #define _QWT_SAMPLING_THREAD_H_ -
trunk/BNC/qwt/qwt_scale_div.cpp
r8127 r9383 71 71 */ 72 72 QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound, 73 const QList<double> &minorTicks, 73 const QList<double> &minorTicks, 74 74 const QList<double> &mediumTicks, 75 75 const QList<double> &majorTicks ): … … 133 133 { 134 134 return d_lowerBound; 135 } 135 } 136 136 137 137 /*! … … 144 144 { 145 145 d_upperBound = upperBound; 146 } 146 } 147 147 148 148 /*! … … 219 219 } 220 220 221 /*! 221 /*! 222 222 Invert the scale division 223 223 \sa inverted() … … 239 239 } 240 240 241 /*! 241 /*! 242 242 \return A scale division with inverted boundaries and ticks 243 243 \sa invert() … … 251 251 } 252 252 253 /*! 253 /*! 254 254 Return a scale division with an interval [lowerBound, upperBound] 255 255 where all ticks outside this interval are removed … … 262 262 \note lowerBound might be greater than upperBound for inverted scales 263 263 */ 264 QwtScaleDiv QwtScaleDiv::bounded( 264 QwtScaleDiv QwtScaleDiv::bounded( 265 265 double lowerBound, double upperBound ) const 266 266 { -
trunk/BNC/qwt/qwt_scale_div.h
r8127 r9383 56 56 }; 57 57 58 explicit QwtScaleDiv( double lowerBound = 0.0, 58 explicit QwtScaleDiv( double lowerBound = 0.0, 59 59 double upperBound = 0.0 ); 60 60 … … 64 64 QList<double>[NTickTypes] ); 65 65 66 explicit QwtScaleDiv( double lowerBound, double upperBound, 66 explicit QwtScaleDiv( double lowerBound, double upperBound, 67 67 const QList<double> &minorTicks, const QList<double> &mediumTicks, 68 68 const QList<double> &majorTicks ); -
trunk/BNC/qwt/qwt_scale_draw.cpp
r8127 r9383 118 118 \param end End border distance 119 119 */ 120 void QwtScaleDraw::getBorderDistHint( 120 void QwtScaleDraw::getBorderDistHint( 121 121 const QFont &font, int &start, int &end ) const 122 122 { … … 235 235 } 236 236 237 double angle = qwtRadians( labelRotation() ); 237 double angle = qwtRadians( labelRotation() ); 238 238 if ( vertical ) 239 239 angle += M_PI / 2; … … 348 348 Find the position, where to paint a label 349 349 350 The position has a distance that depends on the length of the ticks 350 The position has a distance that depends on the length of the ticks 351 351 in direction of the alignment(). 352 352 -
trunk/BNC/qwt/qwt_scale_draw.h
r8127 r9383 36 36 \sa setAlignment(), alignment() 37 37 */ 38 enum Alignment 39 { 38 enum Alignment 39 { 40 40 //! The scale is below 41 BottomScale, 41 BottomScale, 42 42 43 43 //! The scale is above 44 TopScale, 44 TopScale, 45 45 46 46 //! The scale is left 47 LeftScale, 47 LeftScale, 48 48 49 49 //! The scale is right 50 RightScale 50 RightScale 51 51 }; 52 52 … … 81 81 int maxLabelWidth( const QFont & ) const; 82 82 83 QPointF labelPosition( double val ) const;83 QPointF labelPosition( double value ) const; 84 84 85 QRectF labelRect( const QFont &, double val ) const;86 QSizeF labelSize( const QFont &, double val ) const;85 QRectF labelRect( const QFont &, double value ) const; 86 QSizeF labelSize( const QFont &, double value ) const; 87 87 88 QRect boundingLabelRect( const QFont &, double val ) const;88 QRect boundingLabelRect( const QFont &, double value ) const; 89 89 90 90 protected: 91 91 QTransform labelTransformation( const QPointF &, const QSizeF & ) const; 92 92 93 virtual void drawTick( QPainter *, double val , double len ) const;93 virtual void drawTick( QPainter *, double value, double len ) const; 94 94 virtual void drawBackbone( QPainter * ) const; 95 virtual void drawLabel( QPainter *, double val ) const;95 virtual void drawLabel( QPainter *, double value ) const; 96 96 97 97 private: -
trunk/BNC/qwt/qwt_scale_engine.cpp
r8127 r9383 32 32 } 33 33 34 static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval ) 34 static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval ) 35 35 { 36 36 return QwtInterval( qPow( base, interval.minValue() ), … … 52 52 static double qwtStepSize( double intervalSize, int maxSteps, uint base ) 53 53 { 54 const double minStep = 54 const double minStep = 55 55 QwtScaleArithmetic::divideInterval( intervalSize, maxSteps, base ); 56 56 … … 171 171 \return Calculated step size 172 172 */ 173 double QwtScaleArithmetic::divideInterval( 174 double intervalSize, int numSteps, uint base ) 173 double QwtScaleArithmetic::divideInterval( 174 double intervalSize, int numSteps, uint base ) 175 175 { 176 176 if ( numSteps <= 0 ) … … 269 269 270 270 /*! 271 Create and return a clone of the transformation 271 Create and return a clone of the transformation 272 272 of the engine. When the engine has no special transformation 273 273 NULL is returned, indicating no transformation. … … 340 340 double intervalSize, int numSteps ) const 341 341 { 342 return QwtScaleArithmetic::divideInterval( 342 return QwtScaleArithmetic::divideInterval( 343 343 intervalSize, numSteps, d_data->base ); 344 344 } … … 468 468 /*! 469 469 \brief Specify a reference point 470 \param r new reference value470 \param reference New reference value 471 471 472 472 The reference point is needed if options IncludeReference or … … 475 475 \sa Attribute 476 476 */ 477 void QwtScaleEngine::setReference( double r )478 { 479 d_data->referenceValue = r ;477 void QwtScaleEngine::setReference( double reference ) 478 { 479 d_data->referenceValue = reference; 480 480 } 481 481 … … 502 502 */ 503 503 void QwtScaleEngine::setBase( uint base ) 504 { 504 { 505 505 d_data->base = qMax( base, 2U ); 506 506 } … … 559 559 interval = buildInterval( interval.minValue() ); 560 560 561 stepSize = QwtScaleArithmetic::divideInterval( 561 stepSize = QwtScaleArithmetic::divideInterval( 562 562 interval.width(), qMax( maxNumSteps, 1 ), base() ); 563 563 … … 607 607 maxMajorSteps = 1; 608 608 609 stepSize = QwtScaleArithmetic::divideInterval( 609 stepSize = QwtScaleArithmetic::divideInterval( 610 610 interval.width(), maxMajorSteps, base() ); 611 611 } … … 757 757 double x2 = interval.maxValue(); 758 758 759 // when there is no rounding beside some effect, when 759 // when there is no rounding beside some effect, when 760 760 // calculating with doubles, we keep the original value 761 761 … … 868 868 interval = buildInterval( interval.minValue() ); 869 869 870 stepSize = divideInterval( qwtLogInterval( logBase, interval ).width(), 870 stepSize = divideInterval( qwtLogInterval( logBase, interval ).width(), 871 871 qMax( maxNumSteps, 1 ) ); 872 872 if ( stepSize < 1.0 ) … … 928 928 maxMajorSteps = 1; 929 929 930 stepSize = divideInterval( 930 stepSize = divideInterval( 931 931 qwtLogInterval( logBase, interval ).width(), maxMajorSteps ); 932 932 if ( stepSize < 1.0 ) … … 1033 1033 if ( minStep == 0.0 ) 1034 1034 return; 1035 1036 const int numSteps = qRound( stepSize / minStep ); 1035 1036 const int numSteps = qRound( stepSize / minStep ); 1037 1037 1038 1038 int mediumTickIndex = -1; … … 1088 1088 1089 1089 if ( numTicks < 1 ) 1090 return; 1090 return; 1091 1091 1092 1092 int mediumTickIndex = -1; -
trunk/BNC/qwt/qwt_scale_engine.h
r8127 r9383 26 26 static double floorEps( double value, double intervalSize ); 27 27 28 static double divideEps( double interval , double steps );29 30 static double divideInterval( double interval ,28 static double divideEps( double intervalSize, double numSteps ); 29 30 static double divideInterval( double intervalSize, 31 31 int numSteps, uint base ); 32 32 }; … … 40 40 The layout of the scale can be varied with setAttribute(). 41 41 42 Qwt offers implementations for logarithmic and linear scales. 42 Qwt offers implementations for logarithmic and linear scales. 43 43 */ 44 44 … … 46 46 { 47 47 public: 48 /*! 48 /*! 49 49 Layout attributes 50 50 \sa setAttribute(), testAttribute(), reference(), … … 65 65 /*! 66 66 The endpoints of the scale are supposed to be equal the 67 outmost included values plus the specified margins 67 outmost included values plus the specified margins 68 68 (see setMargins()). 69 69 If this attribute is *not* set, the endpoints of the scale will … … 91 91 Attributes attributes() const; 92 92 93 void setReference( double reference);93 void setReference( double ); 94 94 double reference() const; 95 95 … … 129 129 130 130 protected: 131 bool contains( const QwtInterval &, double val ) const;131 bool contains( const QwtInterval &, double value ) const; 132 132 QList<double> strip( const QList<double>&, const QwtInterval & ) const; 133 133 134 double divideInterval( double interval , int numSteps ) const;135 136 QwtInterval buildInterval( double v ) const;134 double divideInterval( double intervalSize, int numSteps ) const; 135 136 QwtInterval buildInterval( double value ) const; 137 137 138 138 private: … … 154 154 virtual ~QwtLinearScaleEngine(); 155 155 156 virtual void autoScale( int max Steps,156 virtual void autoScale( int maxNumSteps, 157 157 double &x1, double &x2, double &stepSize ) const; 158 158 159 159 virtual QwtScaleDiv divideScale( double x1, double x2, 160 int numMajorSteps, int numMinorSteps,161 160 int maxMajorSteps, int maxMinorSteps, 161 double stepSize = 0.0 ) const; 162 162 163 163 … … 166 166 167 167 void buildTicks( 168 const QwtInterval &, double stepSize, int maxMin Steps,168 const QwtInterval &, double stepSize, int maxMinorSteps, 169 169 QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; 170 170 … … 194 194 virtual ~QwtLogScaleEngine(); 195 195 196 virtual void autoScale( int max Steps,196 virtual void autoScale( int maxNumSteps, 197 197 double &x1, double &x2, double &stepSize ) const; 198 198 199 199 virtual QwtScaleDiv divideScale( double x1, double x2, 200 int numMajorSteps, int numMinorSteps,200 int maxMajorSteps, int maxMinorSteps, 201 201 double stepSize = 0.0 ) const; 202 202 … … 205 205 206 206 void buildTicks( 207 const QwtInterval &, double stepSize, int maxMin Steps,207 const QwtInterval &, double stepSize, int maxMinorSteps, 208 208 QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; 209 209 -
trunk/BNC/qwt/qwt_scale_map.cpp
r8127 r9383 94 94 \param s1 first border 95 95 \param s2 second border 96 \warning scales might be aligned to 96 \warning scales might be aligned to 97 97 transformation depending boundaries 98 98 */ … … 187 187 const QwtScaleMap &yMap, const QPointF &pos ) 188 188 { 189 return QPointF( 190 xMap.invTransform( pos.x() ), 191 yMap.invTransform( pos.y() ) 189 return QPointF( 190 xMap.invTransform( pos.x() ), 191 yMap.invTransform( pos.y() ) 192 192 ); 193 193 } … … 206 206 const QwtScaleMap &yMap, const QPointF &pos ) 207 207 { 208 return QPointF( 209 xMap.transform( pos.x() ), 208 return QPointF( 209 xMap.transform( pos.x() ), 210 210 yMap.transform( pos.y() ) 211 211 ); -
trunk/BNC/qwt/qwt_scale_map.h
r8127 r9383 25 25 26 26 QwtScaleMap offers transformations from the coordinate system 27 of a scale into the linear coordinate system of a paint device 27 of a scale into the linear coordinate system of a paint device 28 28 and vice versa. 29 29 */ -
trunk/BNC/qwt/qwt_scale_widget.cpp
r8127 r9383 21 21 #include <qstyle.h> 22 22 #include <qstyleoption.h> 23 #include <qapplication.h> 23 24 24 25 class QwtScaleWidget::PrivateData … … 146 147 else 147 148 d_data->layoutFlags &= ~flag; 149 150 update(); 148 151 } 149 152 } … … 574 577 { 575 578 updateGeometry(); 579 580 #if 1 581 /* 582 for some reason updateGeometry does not send a LayoutRequest event 583 when the parent is not visible and has no layout 584 */ 585 586 if ( QWidget* w = parentWidget() ) 587 { 588 if ( !w->isVisible() && w->layout() == NULL ) 589 { 590 if ( w->testAttribute( Qt::WA_WState_Polished ) ) 591 QApplication::postEvent( w, new QEvent( QEvent::LayoutRequest ) ); 592 } 593 } 594 #endif 595 576 596 update(); 577 597 } … … 768 788 is returned. 769 789 770 \param start Return parameter for the border width at 790 \param start Return parameter for the border width at 771 791 the beginning of the scale 772 \param end Return parameter for the border width at the 792 \param end Return parameter for the border width at the 773 793 end of the scale 774 794 … … 808 828 the widget borders. 809 829 810 \param start Return parameter for the border width at 830 \param start Return parameter for the border width at 811 831 the beginning of the scale 812 \param end Return parameter for the border width at the 832 \param end Return parameter for the border width at the 813 833 end of the scale 814 834 -
trunk/BNC/qwt/qwt_scale_widget.h
r8127 r9383 40 40 { 41 41 /*! 42 The title of vertical scales is painted from top to bottom. 42 The title of vertical scales is painted from top to bottom. 43 43 Otherwise it is painted from bottom to top. 44 44 */ … … 65 65 bool testLayoutFlag( LayoutFlag ) const; 66 66 67 void setBorderDist( int start, int end);67 void setBorderDist( int dist1, int dist2 ); 68 68 int startBorderDist() const; 69 69 int endBorderDist() const; … … 77 77 int margin() const; 78 78 79 void setSpacing( int td);79 void setSpacing( int ); 80 80 int spacing() const; 81 81 82 void setScaleDiv( const QwtScaleDiv & sd);82 void setScaleDiv( const QwtScaleDiv & ); 83 83 void setTransformation( QwtTransform * ); 84 84 … … 120 120 virtual void resizeEvent( QResizeEvent * ); 121 121 122 void draw( QPainter * p) const;122 void draw( QPainter * ) const; 123 123 124 124 void scaleChange(); 125 void layoutScale( bool update = true );125 void layoutScale( bool update_geometry = true ); 126 126 127 127 private: -
trunk/BNC/qwt/qwt_series_data.cpp
r8127 r9383 34 34 static inline QRectF qwtBoundingRect( const QwtSetSample &sample ) 35 35 { 36 if ( sample.set.empty() ) 37 return QRectF( sample.value, 0.0, 0.0, -1.0 ); 38 36 39 double minY = sample.set[0]; 37 40 double maxY = sample.set[0]; … … 41 44 if ( sample.set[i] < minY ) 42 45 minY = sample.set[i]; 46 43 47 if ( sample.set[i] > maxY ) 44 48 maxY = sample.set[i]; 45 49 } 46 50 47 double minX = sample.value; 48 double maxX = sample.value; 49 50 return QRectF( minX, minY, maxX - minX, maxY - minY ); 51 return QRectF( sample.value, minY, 0.0, maxY - minY ); 51 52 } 52 53 -
trunk/BNC/qwt/qwt_series_data.h
r8127 r9383 26 26 to implement an individual data access. 27 27 28 A subclass of QwtSeriesData<QPointF> must implement: 29 30 - size()\n 28 A subclass of QwtSeriesData<QPointF> must implement: 29 30 - size()\n 31 31 Should return number of data points. 32 32 … … 35 35 as QPointF object. 36 36 37 - boundingRect()\n 37 - boundingRect()\n 38 38 Should return the bounding rectangle of the data series. 39 39 It is used for autoscaling and might help certain algorithms for displaying 40 40 the data. You can use qwtBoundingRect() for an implementation 41 but often it is possible to implement a more efficient algorithm 41 but often it is possible to implement a more efficient algorithm 42 42 depending on the characteristics of the series. 43 43 The member d_boundingRect is intended for caching the calculated rectangle. 44 44 45 45 */ 46 46 template <typename T> … … 53 53 //! Destructor 54 54 virtual ~QwtSeriesData(); 55 56 #ifndef QWT_PYTHON_WRAPPER 55 57 56 58 //! \return Number of samples … … 78 80 virtual QRectF boundingRect() const = 0; 79 81 82 #else 83 // Needed for generating the python bindings, but not for using them ! 84 virtual size_t size() const { return 0; } 85 virtual T sample( size_t i ) const { return T(); } 86 virtual QRectF boundingRect() const { return d_boundingRect; } 87 #endif 88 80 89 /*! 81 90 Set a the "rect of interest" … … 86 95 87 96 The default implementation does nothing. 88 97 89 98 \param rect Rectangle of interest 90 99 */ … … 275 284 The following example shows finds a point of curve from an x 276 285 coordinate 277 278 \verbatim 279 #include <qwt_series_data.h> 280 #include <qwt_plot_curve.h> 281 282 struct compareX 283 { 284 inline bool operator()( const double x, const QPointF &pos ) const 285 { 286 return ( x < pos.x() ); 287 } 288 }; 289 290 QLineF curveLineAt( const QwtPlotCurve *curve, double x ) 291 { 292 int index = qwtUpperSampleIndex<QPointF>( 293 *curve->data(), x, compareX() ); 294 295 if ( index == -1 && 296 x == curve->sample( curve->dataSize() - 1 ).x() ) 297 { 298 // the last sample is excluded from qwtUpperSampleIndex 299 index = curve->dataSize() - 1; 300 } 301 302 QLineF line; // invalid 303 if ( index > 0 ) 304 { 305 line.setP1( curve->sample( index - 1 ) ); 306 line.setP2( curve->sample( index ) ); 307 } 308 309 return line; 310 } 311 312 \endverbatim 313 314 315 \param series Series of samples 316 \param value Value 317 \param lessThan Compare operation 318 319 \note The samples must be sorted according to the order specified 320 by the lessThan object 321 322 of the range [begin, end) and returns the position of the one-past-the-last occurrence of value. If no such item is found, returns the position where the item should be inserted. 286 \code 287 #include <qwt_series_data.h> 288 #include <qwt_plot_curve.h> 289 290 struct compareX 291 { 292 inline bool operator()( const double x, const QPointF &pos ) const 293 { 294 return ( x < pos.x() ); 295 } 296 }; 297 298 QLineF curveLineAt( const QwtPlotCurve *curve, double x ) 299 { 300 int index = qwtUpperSampleIndex<QPointF>( 301 *curve->data(), x, compareX() ); 302 303 if ( index == -1 && 304 x == curve->sample( curve->dataSize() - 1 ).x() ) 305 { 306 // the last sample is excluded from qwtUpperSampleIndex 307 index = curve->dataSize() - 1; 308 } 309 310 QLineF line; // invalid 311 if ( index > 0 ) 312 { 313 line.setP1( curve->sample( index - 1 ) ); 314 line.setP2( curve->sample( index ) ); 315 } 316 317 return line; 318 } 319 320 \endcode 321 \endpar 322 323 \param series Series of samples 324 \param value Value 325 \param lessThan Compare operation 326 327 \note The samples must be sorted according to the order specified 328 by the lessThan object 323 329 */ 324 330 template <typename T, typename LessThan> 325 331 inline int qwtUpperSampleIndex( const QwtSeriesData<T> &series, 326 double value, LessThan lessThan ) 332 double value, LessThan lessThan ) 327 333 { 328 334 const int indexMax = series.size() - 1; -
trunk/BNC/qwt/qwt_series_store.h
r8127 r9383 28 28 virtual ~QwtAbstractSeriesStore() {} 29 29 30 #ifndef QWT_PYTHON_WRAPPER 30 31 //! dataChanged() indicates, that the series has been changed. 31 32 virtual void dataChanged() = 0; … … 42 43 //! \return Number of samples 43 44 virtual size_t dataSize() const = 0; 45 #else 46 // Needed for generating the python bindings, but not for using them ! 47 virtual void dataChanged() {} 48 virtual void setRectOfInterest( const QRectF & ) {} 49 virtual QRectF dataRect() const { return QRectF( 0.0, 0.0, -1.0, -1.0 ); } 50 virtual size_t dataSize() const { return 0; } 51 #endif 44 52 }; 45 53 -
trunk/BNC/qwt/qwt_slider.cpp
r8127 r9383 21 21 #include <qapplication.h> 22 22 23 static QSize qwtHandleSize( const QSize &size, 23 static QSize qwtHandleSize( const QSize &size, 24 24 Qt::Orientation orientation, bool hasTrough ) 25 25 { … … 42 42 } 43 43 44 static QwtScaleDraw::Alignment qwtScaleDrawAlignment( 44 static QwtScaleDraw::Alignment qwtScaleDrawAlignment( 45 45 Qt::Orientation orientation, QwtSlider::ScalePosition scalePos ) 46 46 { … … 108 108 /*! 109 109 Construct vertical slider in QwtSlider::Trough style 110 with a scale to the left. 110 with a scale to the left. 111 111 112 112 The scale is initialized to [0.0, 100.0] and the value set to 0.0. … … 131 131 132 132 \param parent Parent widget 133 \param orientation Orientation of the slider. 133 \param orientation Orientation of the slider. 134 134 */ 135 135 QwtSlider::QwtSlider( Qt::Orientation orientation, QWidget *parent ): … … 158 158 d_data->orientation = orientation; 159 159 160 scaleDraw()->setAlignment( 160 scaleDraw()->setAlignment( 161 161 qwtScaleDrawAlignment( orientation, d_data->scalePosition ) ); 162 162 scaleDraw()->setLength( 100 ); … … 179 179 d_data->orientation = orientation; 180 180 181 scaleDraw()->setAlignment( 181 scaleDraw()->setAlignment( 182 182 qwtScaleDrawAlignment( orientation, d_data->scalePosition ) ); 183 183 … … 216 216 217 217 d_data->scalePosition = scalePosition; 218 scaleDraw()->setAlignment( 218 scaleDraw()->setAlignment( 219 219 qwtScaleDrawAlignment( d_data->orientation, scalePosition ) ); 220 220 … … 223 223 } 224 224 225 /*! 225 /*! 226 226 \return Position of the scale 227 227 \sa setScalePosition() … … 412 412 \param sliderRect Bounding rectangle of the slider 413 413 */ 414 void QwtSlider::drawSlider( 414 void QwtSlider::drawSlider( 415 415 QPainter *painter, const QRect &sliderRect ) const 416 416 { … … 434 434 const int slotMargin = 4; 435 435 436 QRect slotRect; 436 QRect slotRect; 437 437 if ( orientation() == Qt::Horizontal ) 438 438 { … … 470 470 \param pos Position of the handle marker in widget coordinates 471 471 */ 472 void QwtSlider::drawHandle( QPainter *painter, 472 void QwtSlider::drawHandle( QPainter *painter, 473 473 const QRect &handleRect, int pos ) const 474 474 { 475 475 const int bw = d_data->borderWidth; 476 476 477 qDrawShadePanel( painter, 477 qDrawShadePanel( painter, 478 478 handleRect, palette(), false, bw, 479 479 &palette().brush( QPalette::Button ) ); … … 497 497 \param pos Mouse position 498 498 499 \retval True, when handleRect() contains pos 499 \retval True, when handleRect() contains pos 500 500 \sa scrolledTo() 501 501 */ … … 504 504 if ( handleRect().contains( pos ) ) 505 505 { 506 const double v = ( orientation() == Qt::Horizontal ) 506 const double v = ( orientation() == Qt::Horizontal ) 507 507 ? pos.x() : pos.y(); 508 508 … … 525 525 double QwtSlider::scrolledTo( const QPoint &pos ) const 526 526 { 527 int p = ( orientation() == Qt::Horizontal ) 527 int p = ( orientation() == Qt::Horizontal ) 528 528 ? pos.x() : pos.y(); 529 529 … … 629 629 630 630 \param event Mouse event 631 */ 631 */ 632 632 void QwtSlider::timerEvent( QTimerEvent *event ) 633 633 { … … 663 663 killTimer( d_data->repeatTimerId ); 664 664 d_data->repeatTimerId = startTimer( updateInterval() ); 665 665 666 666 d_data->timerTick = true; 667 } 667 } 668 668 } 669 669 … … 710 710 void QwtSlider::changeEvent( QEvent *event ) 711 711 { 712 if ( event->type() == QEvent::StyleChange || 712 if ( event->type() == QEvent::StyleChange || 713 713 event->type() == QEvent::FontChange ) 714 714 { … … 740 740 /* 741 741 The marker line of the handle needs to be aligned to 742 the scale. But the marker is in the center 742 the scale. But the marker is in the center 743 743 and we need space enough to display the rest of the handle. 744 744 … … 878 878 { 879 879 d_data->hasGroove = on; 880 880 881 881 if ( testAttribute( Qt::WA_WState_Polished ) ) 882 882 layoutSlider( true ); … … 891 891 { 892 892 return d_data->hasGroove; 893 } 893 } 894 894 895 895 /*! … … 918 918 bw = d_data->borderWidth; 919 919 920 int sliderLength = 0; 920 int sliderLength = 0; 921 921 int scaleExtent = 0; 922 922 -
trunk/BNC/qwt/qwt_slider.h
r8127 r9383 84 84 QSize handleSize() const; 85 85 86 void setBorderWidth( int bw);86 void setBorderWidth( int ); 87 87 int borderWidth() const; 88 88 -
trunk/BNC/qwt/qwt_symbol.cpp
r8127 r9383 32 32 } 33 33 34 static QwtGraphic qwtPathGraphic( const QPainterPath &path, 34 static QwtGraphic qwtPathGraphic( const QPainterPath &path, 35 35 const QPen &pen, const QBrush& brush ) 36 36 { … … 47 47 } 48 48 49 static inline QRectF qwtScaledBoundingRect( 49 static inline QRectF qwtScaledBoundingRect( 50 50 const QwtGraphic &graphic, const QSizeF size ) 51 51 { … … 53 53 if ( scaledSize.isEmpty() ) 54 54 scaledSize = graphic.defaultSize(); 55 55 56 56 const QSizeF sz = graphic.controlPointRect().size(); 57 57 … … 59 59 if ( sz.width() > 0.0 ) 60 60 sx = scaledSize.width() / sz.width(); 61 61 62 62 double sy = 1.0; 63 63 if ( sz.height() > 0.0 ) … … 84 84 if ( pm.size() != size ) 85 85 pm = pm.scaled( size ); 86 86 87 87 QPointF pinPoint( 0.5 * size.width(), 0.5 * size.height() ); 88 88 if ( symbol.isPinPointEnabled() ) … … 95 95 const QPointF pos = transform.map( points[i] ) - pinPoint; 96 96 97 QwtPainter::drawPixmap( painter, 97 QwtPainter::drawPixmap( painter, 98 98 QRect( pos.toPoint(), pm.size() ), pm ); 99 99 } … … 102 102 #ifndef QWT_NO_SVG 103 103 104 static inline void qwtDrawSvgSymbols( QPainter *painter, 105 const QPointF *points, int numPoints, 104 static inline void qwtDrawSvgSymbols( QPainter *painter, 105 const QPointF *points, int numPoints, 106 106 QSvgRenderer *renderer, const QwtSymbol &symbol ) 107 107 { … … 132 132 const double y = points[i].y() - dy; 133 133 134 renderer->render( painter, 134 renderer->render( painter, 135 135 QRectF( x, y, sz.width(), sz.height() ) ); 136 136 } … … 139 139 #endif 140 140 141 static inline void qwtDrawGraphicSymbols( QPainter *painter, 141 static inline void qwtDrawGraphicSymbols( QPainter *painter, 142 142 const QPointF *points, int numPoints, const QwtGraphic &graphic, 143 143 const QwtSymbol &symbol ) … … 876 876 */ 877 877 878 QwtSymbol::QwtSymbol( const QPainterPath &path, 878 QwtSymbol::QwtSymbol( const QPainterPath &path, 879 879 const QBrush &brush, const QPen &pen ) 880 880 { … … 919 919 \brief Set a painter path as symbol 920 920 921 The symbol is represented by a painter path, where the 921 The symbol is represented by a painter path, where the 922 922 origin ( 0, 0 ) of the path coordinate system is mapped to 923 923 the position of the symbol. … … 927 927 the bounding rectangle of the path. 928 928 929 The following code defines a symbol drawing an arrow: 930 931 \verbatim 932 #include <qwt_symbol.h> 933 934 QwtSymbol *symbol = new QwtSymbol(); 935 936 QPen pen( Qt::black, 2 ); 937 pen.setJoinStyle( Qt::MiterJoin ); 938 939 symbol->setPen( pen ); 940 symbol->setBrush( Qt::red ); 941 942 QPainterPath path; 943 path.moveTo( 0, 8 ); 944 path.lineTo( 0, 5 ); 945 path.lineTo( -3, 5 ); 946 path.lineTo( 0, 0 ); 947 path.lineTo( 3, 5 ); 948 path.lineTo( 0, 5 ); 949 950 QTransform transform; 951 transform.rotate( -30.0 ); 952 path = transform.map( path ); 953 954 symbol->setPath( path ); 955 symbol->setPinPoint( QPointF( 0.0, 0.0 ) ); 956 957 setSize( 10, 14 ); 958 \endverbatim 929 \par Example 930 The following code defines a symbol drawing an arrow: 931 932 \code 933 #include <qwt_symbol.h> 934 935 QwtSymbol *symbol = new QwtSymbol(); 936 937 QPen pen( Qt::black, 2 ); 938 pen.setJoinStyle( Qt::MiterJoin ); 939 940 symbol->setPen( pen ); 941 symbol->setBrush( Qt::red ); 942 943 QPainterPath path; 944 path.moveTo( 0, 8 ); 945 path.lineTo( 0, 5 ); 946 path.lineTo( -3, 5 ); 947 path.lineTo( 0, 0 ); 948 path.lineTo( 3, 5 ); 949 path.lineTo( 0, 5 ); 950 951 QTransform transform; 952 transform.rotate( -30.0 ); 953 path = transform.map( path ); 954 955 symbol->setPath( path ); 956 symbol->setPinPoint( QPointF( 0.0, 0.0 ) ); 957 958 setSize( 10, 14 ); 959 \endcode 960 \endpar 959 961 960 962 \param path Painter path … … 1237 1239 The position of a complex symbol is not always aligned to its center 1238 1240 ( f.e an arrow, where the peak points to a position ). The pin point 1239 defines the position inside of a Pixmap, Graphic, SvgDocument 1241 defines the position inside of a Pixmap, Graphic, SvgDocument 1240 1242 or PainterPath symbol where the represented point has to 1241 1243 be aligned to. 1242 1244 1243 1245 \param pos Position 1244 1246 \param enable En/Disable the pin point alignment … … 1341 1343 { 1342 1344 if ( !d_data->size.isEmpty() && 1343 d_data->size != d_data->pixmap.pixmap.size() ) 1345 d_data->size != d_data->pixmap.pixmap.size() ) 1344 1346 { 1345 1347 useCache = true; 1346 1348 } 1347 1349 break; 1348 } 1350 } 1349 1351 default: 1350 1352 useCache = true; … … 1358 1360 const QRect br = boundingRect(); 1359 1361 1360 const QRect rect( 0, 0, br.width(), br.height() );1361 1362 1362 if ( d_data->cache.pixmap.isNull() ) 1363 1363 { … … 1402 1402 1403 1403 \param painter Painter 1404 \param rect Target rectangle for the symbol 1404 \param rect Target rectangle for the symbol 1405 1405 */ 1406 1406 void QwtSymbol::drawSymbol( QPainter *painter, const QRectF &rect ) const … … 1411 1411 if ( d_data->style == QwtSymbol::Graphic ) 1412 1412 { 1413 d_data->graphic.graphic.render( 1413 d_data->graphic.graphic.render( 1414 1414 painter, rect, Qt::KeepAspectRatio ); 1415 1415 } … … 1418 1418 if ( d_data->path.graphic.isNull() ) 1419 1419 { 1420 d_data->path.graphic = qwtPathGraphic( 1420 d_data->path.graphic = qwtPathGraphic( 1421 1421 d_data->path.path, d_data->pen, d_data->brush ); 1422 1422 } 1423 1423 1424 d_data->path.graphic.render( 1424 d_data->path.graphic.render( 1425 1425 painter, rect, Qt::KeepAspectRatio ); 1426 1426 return; … … 1445 1445 } 1446 1446 1447 d_data->svg.renderer->render( 1447 d_data->svg.renderer->render( 1448 1448 painter, scaledRect ); 1449 1449 } … … 1456 1456 // scale the symbol size to fit into rect. 1457 1457 1458 const double ratio = qMin( rect.width() / br.width(), 1458 const double ratio = qMin( rect.width() / br.width(), 1459 1459 rect.height() / br.height() ); 1460 1460 … … 1469 1469 const QPointF pos; 1470 1470 renderSymbols( painter, &pos, 1 ); 1471 1471 1472 1472 d_data->isPinPointEnabled = isPinPointEnabled; 1473 1473 … … 1570 1570 if ( d_data->path.graphic.isNull() ) 1571 1571 { 1572 d_data->path.graphic = qwtPathGraphic( d_data->path.path, 1572 d_data->path.graphic = qwtPathGraphic( d_data->path.path, 1573 1573 d_data->pen, d_data->brush ); 1574 1574 } 1575 1575 1576 qwtDrawGraphicSymbols( painter, points, numPoints, 1576 qwtDrawGraphicSymbols( painter, points, numPoints, 1577 1577 d_data->path.graphic, *this ); 1578 1578 break; … … 1585 1585 case QwtSymbol::Graphic: 1586 1586 { 1587 qwtDrawGraphicSymbols( painter, points, numPoints, 1587 qwtDrawGraphicSymbols( painter, points, numPoints, 1588 1588 d_data->graphic.graphic, *this ); 1589 1589 break; … … 1592 1592 { 1593 1593 #ifndef QWT_NO_SVG 1594 qwtDrawSvgSymbols( painter, points, numPoints, 1594 qwtDrawSvgSymbols( painter, points, numPoints, 1595 1595 d_data->svg.renderer, *this ); 1596 1596 #endif … … 1654 1654 } 1655 1655 1656 rect = qwtScaledBoundingRect( 1656 rect = qwtScaledBoundingRect( 1657 1657 d_data->path.graphic, d_data->size ); 1658 1658 pinPointTranslation = true; … … 1666 1666 else 1667 1667 rect.setSize( d_data->size ); 1668 1668 1669 1669 pinPointTranslation = true; 1670 1670 … … 1673 1673 case QwtSymbol::Graphic: 1674 1674 { 1675 rect = qwtScaledBoundingRect( 1675 rect = qwtScaledBoundingRect( 1676 1676 d_data->graphic.graphic, d_data->size ); 1677 1677 pinPointTranslation = true; -
trunk/BNC/qwt/qwt_symbol.h
r8127 r9383 86 86 87 87 /*! 88 The symbol is represented by a painter path, where the 88 The symbol is represented by a painter path, where the 89 89 origin ( 0, 0 ) of the path coordinate system is mapped to 90 90 the position of the symbol. … … 132 132 133 133 F.e. the raster paint engine is a pure software renderer 134 where in cache mode a draw operation usually ends in 134 where in cache mode a draw operation usually ends in 135 135 raster operation with the the backing store, that are usually 136 136 faster, than the algorithms for rendering polygons. … … 142 142 \sa setCachePolicy(), cachePolicy() 143 143 144 \note The policy has no effect, when the symbol is painted 144 \note The policy has no effect, when the symbol is painted 145 145 to a vector graphics format ( PDF, SVG ). 146 146 \warning Since Qt 4.8 raster is the default backend on X11 … … 155 155 Cache, 156 156 157 /*! 157 /*! 158 158 Use a cache when one of the following conditions is true: 159 159 160 - The symbol is rendered with the software 160 - The symbol is rendered with the software 161 161 renderer ( QPaintEngine::Raster ) 162 162 */ … … 176 176 void setSize( const QSize & ); 177 177 void setSize( int width, int height = -1 ); 178 const QSize &size() const;178 const QSize &size() const; 179 179 180 180 void setPinPoint( const QPointF &pos, bool enable = true ); … … 186 186 virtual void setColor( const QColor & ); 187 187 188 void setBrush( const QBrush & b);189 const QBrush &brush() const;188 void setBrush( const QBrush & ); 189 const QBrush &brush() const; 190 190 191 191 void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine ); 192 192 void setPen( const QPen & ); 193 const QPen &pen() const;193 const QPen &pen() const; 194 194 195 195 void setStyle( Style ); -
trunk/BNC/qwt/qwt_system_clock.cpp
r8127 r9383 33 33 delete d_data; 34 34 } 35 35 36 36 bool QwtSystemClock::isNull() const 37 37 { 38 38 return d_data->timer.isValid(); 39 39 } 40 40 41 41 void QwtSystemClock::start() 42 42 { … … 55 55 return nsecs / 1e6; 56 56 } 57 57 58 58 #else // !USE_ELAPSED_TIMER 59 59 … … 357 357 358 358 /*! 359 Set the start time to the current time 359 Set the start time to the current time 360 360 \return Time, that is elapsed since the previous start time. 361 361 */ -
trunk/BNC/qwt/qwt_system_clock.h
r8127 r9383 23 23 Precision and time intervals are multiples of milliseconds (ms). 24 24 25 ( QwtSystemClock is obsolete since Qt 4.8 as QElapsedTimer offers the same 26 precision ) 27 25 28 \note The implementation uses high-resolution performance counter on Windows, 26 mach_absolute_time() on the Mac or POSIX timers on other systems. 29 mach_absolute_time() on the Mac or POSIX timers on other systems. 27 30 If none is available it falls back on QTimer. 28 31 */ -
trunk/BNC/qwt/qwt_text.cpp
r8127 r9383 62 62 QwtTextEngineDict::~QwtTextEngineDict() 63 63 { 64 for ( EngineMap::const_iterator it = d_map. begin();65 it != d_map. end(); ++it )64 for ( EngineMap::const_iterator it = d_map.constBegin(); 65 it != d_map.constEnd(); ++it ) 66 66 { 67 67 const QwtTextEngine *textEngine = engine( it ); … … 108 108 return; 109 109 110 EngineMap::const_iterator it = d_map.find( format ); 111 if ( it != d_map.end() ) 112 { 113 const QwtTextEngine *e = this->engine( it ); 114 if ( e ) 115 delete e; 116 110 EngineMap::const_iterator it = d_map.constFind( format ); 111 if ( it != d_map.constEnd() ) 112 { 113 delete this->engine( it ); 117 114 d_map.remove( format ); 118 115 } -
trunk/BNC/qwt/qwt_text.h
r8127 r9383 81 81 Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine 82 82 to display the text. The Qwt MathML extension offers such an engine 83 based on the MathML renderer of the Qt solutions package.83 based on the MathML renderer of the former Qt solutions package. 84 84 To enable MathML support the following code needs to be added to the 85 85 application: 86 \verbatim QwtText::setTextEngine(QwtText::MathMLText, new QwtMathMLTextEngine()); \endverbatim 86 87 \code 88 QwtText::setTextEngine( QwtText::MathMLText, new QwtMathMLTextEngine() ); 89 \endcode 87 90 */ 88 91 MathMLText, … … 140 143 typedef QFlags<LayoutAttribute> LayoutAttributes; 141 144 142 QwtText( const QString & = QString ::null,145 QwtText( const QString & = QString(), 143 146 TextFormat textFormat = AutoText ); 144 147 QwtText( const QwtText & ); … … 162 165 QFont usedFont( const QFont & ) const; 163 166 164 void setRenderFlags( int flags);167 void setRenderFlags( int ); 165 168 int renderFlags() const; 166 169 … … 190 193 void draw( QPainter *painter, const QRectF &rect ) const; 191 194 192 static const QwtTextEngine *textEngine( 195 static const QwtTextEngine *textEngine( 193 196 const QString &text, QwtText::TextFormat = AutoText ); 194 197 -
trunk/BNC/qwt/qwt_text_engine.cpp
r8127 r9383 86 86 87 87 QMap<QString, int>::const_iterator it = 88 d_ascentCache.find( fontKey ); 89 if ( it == d_ascentCache.end() ) 90 { 91 int ascent = findAscent( font ); 92 it = d_ascentCache.insert( fontKey, ascent ); 93 } 94 95 return ( *it ); 88 d_ascentCache.constFind( fontKey ); 89 90 if ( it != d_ascentCache.constEnd() ) 91 return *it; 92 93 const int ascent = findAscent( font ); 94 d_ascentCache.insert( fontKey, ascent ); 95 96 return ascent; 96 97 } 97 98 … … 116 117 for ( row = 0; row < img.height(); row++ ) 117 118 { 118 const QRgb *line = reinterpret_cast<const QRgb *>( 119 const QRgb *line = reinterpret_cast<const QRgb *>( 119 120 img.scanLine( row ) ); 120 121 -
trunk/BNC/qwt/qwt_text_engine.h
r8127 r9383 26 26 27 27 QwtPlainTextEngine and QwtRichTextEngine are part of the Qwt library. 28 The implementation of QwtMathMLTextEngine uses code from the 28 The implementation of QwtMathMLTextEngine uses code from the 29 29 Qt solution package. Because of license implications it is built into 30 30 a separate library. 31 31 32 32 \sa QwtText::setTextEngine() 33 33 */ -
trunk/BNC/qwt/qwt_text_label.cpp
r8127 r9383 90 90 \sa QwtText 91 91 */ 92 void QwtTextLabel::setText( const QString &text, 92 void QwtTextLabel::setText( const QString &text, 93 93 QwtText::TextFormat textFormat ) 94 94 { -
trunk/BNC/qwt/qwt_text_label.h
r8127 r9383 64 64 65 65 protected: 66 virtual void paintEvent( QPaintEvent * e);66 virtual void paintEvent( QPaintEvent * ); 67 67 virtual void drawContents( QPainter * ); 68 68 -
trunk/BNC/qwt/qwt_thermo.cpp
r8127 r9383 20 20 #include <qmath.h> 21 21 22 static inline void qwtDrawLine( QPainter *painter, int pos, 22 static inline void qwtDrawLine( QPainter *painter, int pos, 23 23 const QColor &color, const QRect &pipeRect, const QRect &liquidRect, 24 24 Qt::Orientation orientation ) … … 59 59 if ( v > lowerLimit && v < upperLimit ) 60 60 values += v; 61 } 62 } 61 } 62 } 63 63 64 64 values += upperLimit; 65 65 66 66 return values; 67 67 } … … 249 249 250 250 const QBrush brush = palette().brush( QPalette::Base ); 251 qDrawShadePanel( &painter, 251 qDrawShadePanel( &painter, 252 252 tRect.adjusted( -bw, -bw, bw, bw ), 253 palette(), true, bw, 253 palette(), true, bw, 254 254 d_data->autoFillPipe ? &brush : NULL ); 255 255 … … 257 257 } 258 258 259 /*! 259 /*! 260 260 Resize event handler 261 261 \param event Resize event … … 267 267 } 268 268 269 /*! 269 /*! 270 270 Qt change event handler 271 271 \param event Event … … 411 411 if ( d_data->scalePosition == QwtThermo::LeadingScale ) 412 412 pipeRect.setLeft( bw ); 413 else 413 else 414 414 pipeRect.setLeft( cr.left() + cr.width() - bw - d_data->pipeWidth ); 415 415 … … 540 540 \param pipeRect Bounding rectangle of the pipe without borders 541 541 */ 542 void QwtThermo::drawLiquid( 542 void QwtThermo::drawLiquid( 543 543 QPainter *painter, const QRect &pipeRect ) const 544 544 { … … 582 582 const double v = scaleMap.invTransform( pos ); 583 583 584 qwtDrawLine( painter, pos, 584 qwtDrawLine( painter, pos, 585 585 d_data->colorMap->color( interval, v ), 586 586 pipeRect, liquidRect, d_data->orientation ); … … 708 708 /*! 709 709 \brief Change the brush of the liquid. 710 710 711 711 Changes the QPalette::ButtonText brush of the palette. 712 712 713 \param brush New brush. 713 \param brush New brush. 714 714 \sa fillBrush(), QWidget::setPalette() 715 715 */ … … 722 722 723 723 /*! 724 \return Liquid ( QPalette::ButtonText ) brush. 724 \return Liquid ( QPalette::ButtonText ) brush. 725 725 \sa setFillBrush(), QWidget::palette() 726 726 */ … … 735 735 Changes the QPalette::Highlight brush of the palette. 736 736 737 \param brush New brush. 737 \param brush New brush. 738 738 \sa alarmBrush(), QWidget::setPalette() 739 739 … … 825 825 } 826 826 827 /*! 827 /*! 828 828 \return True, when the alarm threshold is enabled. 829 829 … … 894 894 QRect QwtThermo::fillRect( const QRect &pipeRect ) const 895 895 { 896 double origin; 896 double origin; 897 897 if ( d_data->originMode == OriginMinimum ) 898 898 { … … 915 915 if ( to < from ) 916 916 qSwap( from, to ); 917 917 918 918 QRect fillRect = pipeRect; 919 919 if ( d_data->orientation == Qt::Horizontal ) … … 947 947 948 948 const bool inverted = ( upperBound() < lowerBound() ); 949 949 950 950 bool increasing; 951 951 if ( d_data->originMode == OriginCustom ) … … 961 961 const int alarmPos = qRound( map.transform( d_data->alarmLevel ) ); 962 962 const int valuePos = qRound( map.transform( d_data->value ) ); 963 963 964 964 if ( d_data->orientation == Qt::Horizontal ) 965 965 { … … 1003 1003 1004 1004 return alarmRect; 1005 } 1005 } -
trunk/BNC/qwt/qwt_thermo.h
r8127 r9383 30 30 31 31 The fill colors might be calculated from an optional color map 32 If no color map has been assigned QwtThermo uses the 32 If no color map has been assigned QwtThermo uses the 33 33 following colors/brushes from the widget palette: 34 34 … … 53 53 Q_PROPERTY( Qt::Orientation orientation 54 54 READ orientation WRITE setOrientation ) 55 Q_PROPERTY( ScalePosition scalePosition 55 Q_PROPERTY( ScalePosition scalePosition 56 56 READ scalePosition WRITE setScalePosition ) 57 57 Q_PROPERTY( OriginMode originMode READ originMode WRITE setOriginMode ) … … 113 113 int spacing() const; 114 114 115 void setBorderWidth( int w);115 void setBorderWidth( int ); 116 116 int borderWidth() const; 117 117 … … 122 122 double origin() const; 123 123 124 void setFillBrush( const QBrush & b);124 void setFillBrush( const QBrush & ); 125 125 QBrush fillBrush() const; 126 126 127 void setAlarmBrush( const QBrush & b);127 void setAlarmBrush( const QBrush & ); 128 128 QBrush alarmBrush() const; 129 129 130 void setAlarmLevel( double v);130 void setAlarmLevel( double ); 131 131 double alarmLevel() const; 132 132 133 void setAlarmEnabled( bool tf);133 void setAlarmEnabled( bool ); 134 134 bool alarmEnabled() const; 135 135 … … 138 138 const QwtColorMap *colorMap() const; 139 139 140 void setPipeWidth( int w);140 void setPipeWidth( int ); 141 141 int pipeWidth() const; 142 142 … … 153 153 154 154 public Q_SLOTS: 155 virtual void setValue( double val);155 virtual void setValue( double ); 156 156 157 157 protected: -
trunk/BNC/qwt/qwt_transform.cpp
r8127 r9383 19 19 //! Smallest allowed value for logarithmic scales: 1.0e-150 20 20 const double QwtLogTransform::LogMin = 1.0e-150; 21 21 22 22 //! Largest allowed value for logarithmic scales: 1.0e150 23 23 const double QwtLogTransform::LogMax = 1.0e150; … … 43 43 } 44 44 45 /*! 45 /*! 46 46 \param value Value to be bounded 47 47 \return value unmodified … … 63 63 } 64 64 65 /*! 65 /*! 66 66 \param value Value to be transformed 67 67 \return value unmodified … … 72 72 } 73 73 74 /*! 74 /*! 75 75 \param value Value to be transformed 76 76 \return value unmodified … … 98 98 } 99 99 100 /*! 100 /*! 101 101 \param value Value to be transformed 102 102 \return log( value ) … … 107 107 } 108 108 109 /*! 109 /*! 110 110 \param value Value to be transformed 111 111 \return exp( value ) … … 116 116 } 117 117 118 /*! 118 /*! 119 119 \param value Value to be bounded 120 120 \return qBound( LogMin, value, LogMax ) … … 146 146 } 147 147 148 /*! 148 /*! 149 149 \param value Value to be transformed 150 150 \return Exponentiation preserving the sign … … 156 156 else 157 157 return qPow( value, 1.0 / d_exponent ); 158 158 159 159 } 160 160 161 /*! 161 /*! 162 162 \param value Value to be transformed 163 163 \return Inverse exponentiation preserving the sign -
trunk/BNC/qwt/qwt_transform.h
r8127 r9383 73 73 74 74 QwtNullTransform returns the values unmodified. 75 75 76 76 */ 77 77 class QWT_EXPORT QwtNullTransform: public QwtTransform … … 92 92 93 93 \note In the calculations of QwtScaleMap the base of the log function 94 has no effect on the mapping. So QwtLogTransform can be used 94 has no effect on the mapping. So QwtLogTransform can be used 95 95 for log2(), log10() or any other logarithmic scale. 96 96 */ 97 97 class QWT_EXPORT QwtLogTransform: public QwtTransform 98 { 98 { 99 99 public: 100 100 QwtLogTransform(); 101 101 virtual ~QwtLogTransform(); 102 102 103 103 virtual double transform( double value ) const; 104 104 virtual double invTransform( double value ) const; … … 120 120 \brief A transformation using pow() 121 121 122 QwtPowerTransform preserves the sign of a value. 122 QwtPowerTransform preserves the sign of a value. 123 123 F.e. a transformation with a factor of 2 124 124 transforms a value of -3 to -9 and v.v. Thus QwtPowerTransform -
trunk/BNC/qwt/qwt_wheel.cpp
r8127 r9383 55 55 wrapping( false ) 56 56 { 57 } ;57 } 58 58 59 59 Qt::Orientation orientation; … … 114 114 \brief En/Disable tracking 115 115 116 If tracking is enabled (the default), the wheel emits the valueChanged() 117 signal while the wheel is moving. If tracking is disabled, the wheel 116 If tracking is enabled (the default), the wheel emits the valueChanged() 117 signal while the wheel is moving. If tracking is disabled, the wheel 118 118 emits the valueChanged() signal only when the wheel movement is terminated. 119 119 … … 162 162 \brief Mouse press event handler 163 163 164 Start movement of the wheel. 164 Start movement of the wheel. 165 165 166 166 \param event Mouse event … … 209 209 d_data->speed = ( mouseValue - d_data->mouseValue ) / ms; 210 210 } 211 212 d_data->mouseValue = mouseValue; 211 212 d_data->mouseValue = mouseValue; 213 213 214 214 double value = boundedValue( mouseValue - d_data->mouseOffset ); 215 215 if ( d_data->stepAlignment ) 216 216 value = alignedValue( value ); 217 217 218 218 if ( value != d_data->value ) 219 219 { … … 238 238 239 239 \param event Mouse event 240 */ 240 */ 241 241 242 242 void QwtWheel::mouseReleaseEvent( QMouseEvent *event ) … … 260 260 if ( startFlying ) 261 261 { 262 d_data->flyingValue = 262 d_data->flyingValue = 263 263 boundedValue( d_data->mouseValue - d_data->mouseOffset ); 264 264 … … 281 281 282 282 The flying wheel effect is implemented using a timer 283 283 284 284 \param event Timer event 285 285 … … 323 323 \brief Handle wheel events 324 324 325 In/Decrement the value 325 In/Decrement the value 326 326 327 327 \param event Wheel event … … 342 342 double increment = 0.0; 343 343 344 if ( ( event->modifiers() & Qt::ControlModifier) || 344 if ( ( event->modifiers() & Qt::ControlModifier) || 345 345 ( event->modifiers() & Qt::ShiftModifier ) ) 346 346 { … … 384 384 385 385 - Qt::Key_Up\n 386 In case of a horizontal or not inverted vertical wheel the value 386 In case of a horizontal or not inverted vertical wheel the value 387 387 will be incremented by the step size. For an inverted vertical wheel 388 388 the value will be decremented by the step size. 389 389 390 390 - Qt::Key_Down\n 391 In case of a horizontal or not inverted vertical wheel the value 391 In case of a horizontal or not inverted vertical wheel the value 392 392 will be decremented by the step size. For an inverted vertical wheel 393 393 the value will be incremented by the step size. … … 482 482 if ( event->isAccepted() ) 483 483 stopFlying(); 484 484 485 485 if ( increment != 0.0 ) 486 486 { … … 552 552 553 553 /*! 554 \return Wheel border width 554 \return Wheel border width 555 555 \sa setWheelBorderWidth() 556 556 */ … … 561 561 562 562 /*! 563 \brief Set the border width 563 \brief Set the border width 564 564 565 565 The border defaults to 2. … … 575 575 576 576 /*! 577 \return Border width 577 \return Border width 578 578 \sa setBorderWidth() 579 579 */ … … 683 683 } 684 684 685 /*! 685 /*! 686 686 Determine the value corresponding to a specified point 687 687 … … 724 724 } 725 725 726 /*! 726 /*! 727 727 \brief Qt Paint Event 728 728 \param event Paint event … … 737 737 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); 738 738 739 qDrawShadePanel( &painter, 739 qDrawShadePanel( &painter, 740 740 contentsRect(), palette(), true, d_data->borderWidth ); 741 741 … … 753 753 \param rect Geometry for the wheel 754 754 */ 755 void QwtWheel::drawWheelBackground( 755 void QwtWheel::drawWheelBackground( 756 756 QPainter *painter, const QRectF &rect ) 757 757 { … … 761 761 762 762 // draw shaded background 763 QLinearGradient gradient( rect.topLeft(), 763 QLinearGradient gradient( rect.topLeft(), 764 764 ( d_data->orientation == Qt::Horizontal ) ? rect.topRight() : rect.bottomLeft() ); 765 765 gradient.setColorAt( 0.0, pal.color( QPalette::Button ) ); … … 772 772 // draw internal border 773 773 774 const QPen lightPen( palette().color( QPalette::Light ), 774 const QPen lightPen( palette().color( QPalette::Light ), 775 775 d_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap ); 776 const QPen darkPen( pal.color( QPalette::Dark ), 776 const QPen darkPen( pal.color( QPalette::Dark ), 777 777 d_data->wheelBorderWidth, Qt::SolidLine, Qt::FlatCap ); 778 778 … … 782 782 { 783 783 painter->setPen( lightPen ); 784 painter->drawLine( QPointF( rect.left(), rect.top() + bw2 ), 784 painter->drawLine( QPointF( rect.left(), rect.top() + bw2 ), 785 785 QPointF( rect.right(), rect.top() + bw2 ) ); 786 786 787 787 painter->setPen( darkPen ); 788 painter->drawLine( QPointF( rect.left(), rect.bottom() - bw2 ), 788 painter->drawLine( QPointF( rect.left(), rect.bottom() - bw2 ), 789 789 QPointF( rect.right(), rect.bottom() - bw2 ) ); 790 790 } … … 792 792 { 793 793 painter->setPen( lightPen ); 794 painter->drawLine( QPointF( rect.left() + bw2, rect.top() ), 794 painter->drawLine( QPointF( rect.left() + bw2, rect.top() ), 795 795 QPointF( rect.left() + bw2, rect.bottom() ) ); 796 796 797 797 painter->setPen( darkPen ); 798 painter->drawLine( QPointF( rect.right() - bw2, rect.top() ), 798 painter->drawLine( QPointF( rect.right() - bw2, rect.top() ), 799 799 QPointF( rect.right() - bw2, rect.bottom() ) ); 800 800 } … … 818 818 } 819 819 820 const QPen lightPen( palette().color( QPalette::Light ), 820 const QPen lightPen( palette().color( QPalette::Light ), 821 821 0, Qt::SolidLine, Qt::FlatCap ); 822 const QPen darkPen( palette().color( QPalette::Dark ), 822 const QPen darkPen( palette().color( QPalette::Dark ), 823 823 0, Qt::SolidLine, Qt::FlatCap ); 824 824 … … 857 857 858 858 double tickPos; 859 if ( d_data->inverted ) 859 if ( d_data->inverted ) 860 860 tickPos = rect.left() + off; 861 861 else … … 865 865 { 866 866 painter->setPen( darkPen ); 867 painter->drawLine( QPointF( tickPos - 1 , l1 ), 867 painter->drawLine( QPointF( tickPos - 1 , l1 ), 868 868 QPointF( tickPos - 1, l2 ) ); 869 869 painter->setPen( lightPen ); 870 painter->drawLine( QPointF( tickPos, l1 ), 870 painter->drawLine( QPointF( tickPos, l1 ), 871 871 QPointF( tickPos, l2 ) ); 872 872 } … … 907 907 { 908 908 painter->setPen( darkPen ); 909 painter->drawLine( QPointF( l1, tickPos - 1 ), 909 painter->drawLine( QPointF( l1, tickPos - 1 ), 910 910 QPointF( l2, tickPos - 1 ) ); 911 911 painter->setPen( lightPen ); 912 painter->drawLine( QPointF( l1, tickPos ), 912 painter->drawLine( QPointF( l1, tickPos ), 913 913 QPointF( l2, tickPos ) ); 914 914 } … … 1014 1014 1015 1015 /*! 1016 \brief Set the page step count 1017 1016 \brief Set the page step count 1017 1018 1018 pageStepCount is a multiplicator for the single step size 1019 1019 that typically corresponds to the user pressing PageUp or PageDown. 1020 1021 A value of 0 disables page stepping. 1020 1021 A value of 0 disables page stepping. 1022 1022 1023 1023 The default value is 1. … … 1031 1031 } 1032 1032 1033 /*! 1033 /*! 1034 1034 \return Page step count 1035 1035 \sa setPageStepCount(), singleStep() … … 1150 1150 The direction of an inverted horizontal wheel will be from right to left 1151 1151 an inverted vertical wheel will increase from bottom to top. 1152 1152 1153 1153 \param on En/Disable inverted appearance 1154 1154 \sa isInverted() 1155 1155 1156 1156 */ 1157 1157 void QwtWheel::setInverted( bool on ) … … 1176 1176 \brief En/Disable wrapping 1177 1177 1178 If wrapping is true stepping up from maximum() value will take 1179 you to the minimum() value and vice versa. 1178 If wrapping is true stepping up from maximum() value will take 1179 you to the minimum() value and vice versa. 1180 1180 1181 1181 \param on En/Disable wrapping … … 1251 1251 { 1252 1252 const double range = d_data->maximum - d_data->minimum; 1253 1253 1254 1254 if ( d_data->wrapping && range >= 0.0 ) 1255 1255 { … … 1257 1257 { 1258 1258 value += ::ceil( ( d_data->minimum - value ) / range ) * range; 1259 } 1259 } 1260 1260 else if ( value > d_data->maximum ) 1261 1261 { … … 1293 1293 } 1294 1294 } 1295 } 1295 } 1296 1296 1297 1297 return value; -
trunk/BNC/qwt/qwt_wheel.h
r8127 r9383 78 78 int borderWidth() const; 79 79 80 void setInverted( bool tf);80 void setInverted( bool ); 81 81 bool isInverted() const; 82 82 83 void setWrapping( bool tf);83 void setWrapping( bool ); 84 84 bool wrapping() const; 85 85 … … 93 93 bool stepAlignment() const; 94 94 95 void setRange( double vmin, double vmax );95 void setRange( double min, double max ); 96 96 97 void setMinimum( double min);97 void setMinimum( double ); 98 98 double minimum() const; 99 99 100 void setMaximum( double max);100 void setMaximum( double ); 101 101 double maximum() const; 102 102 … … 104 104 int updateInterval() const; 105 105 106 void setTracking( bool enable);106 void setTracking( bool ); 107 107 bool isTracking() const; 108 108 … … 121 121 122 122 When tracking is enabled this signal will be emitted every 123 time the value changes. 123 time the value changes. 124 124 125 125 \param value new value -
trunk/BNC/qwt/qwt_widget_overlay.cpp
r8127 r9383 12 12 #include <qpainter.h> 13 13 #include <qpaintengine.h> 14 #include <qpainterpath.h> 14 15 #include <qimage.h> 15 16 #include <qevent.h> … … 23 24 } 24 25 25 static QRegion qwtAlphaMask( 26 const QImage& image, const QVector<QRect> rects )26 static QRegion qwtAlphaMask( 27 const QImage& image, const QVector<QRect> &rects ) 27 28 { 28 29 const int w = image.width(); … … 42 43 y2 = qMin( y2, h - 1 ); 43 44 44 for ( int y = y1; y <= y2; ++y ) 45 for ( int y = y1; y <= y2; ++y ) 45 46 { 46 47 bool inRect = false; 47 48 int rx0 = -1; 48 49 49 const uint *line = 50 const uint *line = 50 51 reinterpret_cast<const uint *> ( image.scanLine( y ) ) + x1; 51 for ( int x = x1; x <= x2; x++ ) 52 for ( int x = x1; x <= x2; x++ ) 52 53 { 53 54 const bool on = ( ( *line++ >> 24 ) != 0 ); 54 if ( on != inRect ) 55 if ( on != inRect ) 55 56 { 56 if ( inRect ) 57 if ( inRect ) 57 58 { 58 59 rect.setCoords( rx0, y, x - 1, y ); 59 60 region += rect; 60 } 61 else 61 } 62 else 62 63 { 63 64 rx0 = x; … … 65 66 66 67 inRect = on; 67 } 68 } 68 69 } 69 70 70 if ( inRect ) 71 if ( inRect ) 71 72 { 72 73 rect.setCoords( rx0, y, x2, y ); … … 212 213 d_data->rgbaBuffer = ( uchar* )::calloc( width() * height(), 4 ); 213 214 214 QImage image( d_data->rgbaBuffer, 215 QImage image( d_data->rgbaBuffer, 215 216 width(), height(), qwtMaskImageFormat() ); 216 217 … … 249 250 void QwtWidgetOverlay::paintEvent( QPaintEvent* event ) 250 251 { 251 const QRegion clipRegion = event->region();252 const QRegion &clipRegion = event->region(); 252 253 253 254 QPainter painter( this ); … … 266 267 if ( d_data->rgbaBuffer && useRgbaBuffer ) 267 268 { 268 const QImage image( d_data->rgbaBuffer, 269 const QImage image( d_data->rgbaBuffer, 269 270 width(), height(), qwtMaskImageFormat() ); 270 271 -
trunk/BNC/qwt/qwt_widget_overlay.h
r8127 r9383 23 23 heavy repaint operation of the widget below. 24 24 25 F.e. in combination with the plot canvas an overlay 26 avoid replots as the content of the canvas can be restored from 25 F.e. in combination with the plot canvas an overlay 26 avoid replots as the content of the canvas can be restored from 27 27 its backing store. 28 28 … … 33 33 - maskHint() 34 34 35 Internally QwtPlotPicker uses overlays for displaying 35 Internally QwtPlotPicker uses overlays for displaying 36 36 the rubber band and the tracker text. 37 37 … … 47 47 the masked regions of the overlay only. Otherwise 48 48 Qt triggers full repaints. On less powerful hardware 49 ( f.e embedded systems ) - or when using the raster paint 49 ( f.e embedded systems ) - or when using the raster paint 50 50 engine on a remote desktop - bit blitting is a noticeable 51 51 operation, that needs to be avoided. 52 53 If and how to mask depends on how expensive the calculation 52 53 If and how to mask depends on how expensive the calculation 54 54 of the mask is and how many pixels can be excluded by the mask. 55 55 … … 66 66 \brief Use maskHint() as mask 67 67 68 For many situations a fast approximation is good enough 68 For many situations a fast approximation is good enough 69 69 and it is not necessary to build a more detailed mask 70 70 ( f.e the bounding rectangle of a text ). … … 78 78 and the mask needs to be calculated by drawing the overlay 79 79 and testing the result. 80 80 81 81 When a valid maskHint() is available 82 82 only pixels inside this approximation are checked. -
trunk/BNC/qwt/src.pri
r8127 r9383 181 181 qwt_series_data.cpp \ 182 182 qwt_point_data.cpp \ 183 qwt_scale_widget.cpp 183 qwt_scale_widget.cpp 184 185 contains(QWT_CONFIG, QwtOpenGL) { 186 187 HEADERS += \ 188 qwt_plot_glcanvas.h 189 190 SOURCES += \ 191 qwt_plot_glcanvas.cpp 192 } 193 194 contains(QWT_CONFIG, QwtSvg) { 195 196 HEADERS += \ 197 qwt_plot_svgitem.h 198 199 SOURCES += \ 200 qwt_plot_svgitem.cpp 201 } 184 202 } 185 203 … … 192 210 contains(QWT_CONFIG, QwtSvg) { 193 211 194 QT += svg 195 196 HEADERS += qwt_plot_svgitem.h 197 SOURCES += qwt_plot_svgitem.cpp 212 greaterThan(QT_MAJOR_VERSION, 4) { 213 214 qtHaveModule(svg) { 215 QT += svg 216 } 217 else { 218 warning("QwtSvg is enabled in qwtconfig.pri, but Qt has not been built with svg support") 219 } 220 } 221 else { 222 QT += svg 223 } 198 224 } 199 225 else { … … 205 231 206 232 QT += opengl 207 208 HEADERS += qwt_plot_glcanvas.h209 SOURCES += qwt_plot_glcanvas.cpp210 233 } 211 234 else { -
trunk/BNC/qwtpolar/qwt_polar_canvas.cpp
r8127 r9383 215 215 QWidget *bgWidget = qwtBackgroundWidget( plot() ); 216 216 217 218 217 QwtPainter::fillPixmap( bgWidget, bs, 218 mapTo( bgWidget, rect().topLeft() ) ); 219 219 220 220 p.begin( &bs );
Note:
See TracChangeset
for help on using the changeset viewer.