Changeset 9383 in ntrip
- Timestamp:
- Mar 19, 2021, 9:15:03 AM (3 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