Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_plot_zoomer.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_plot_zoomer.cpp (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_zoomer.cpp
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 11 11 #include "qwt_plot.h" 12 12 #include "qwt_scale_div.h" 13 #include "qwt_scale_map.h" 14 #include "qwt_interval.h" 13 15 #include "qwt_picker_machine.h" 14 #include <qalgorithms.h> 16 17 #include <qstack.h> 15 18 16 19 static QwtInterval qwtExpandedZoomInterval( double v1, double v2, … … 50 53 } 51 54 52 static QRectF qwtExpandedZoomRect( const QRectF &zoomRect, const QSizeF&minSize,55 static QRectF qwtExpandedZoomRect( const QRectF& zoomRect, const QSizeF& minSize, 53 56 const QwtTransform* transformX, const QwtTransform* transformY ) 54 57 { … … 78 81 class QwtPlotZoomer::PrivateData 79 82 { 80 public: 83 public: 81 84 uint zoomRectIndex; 82 QStack< QRectF> zoomStack;85 QStack< QRectF > zoomStack; 83 86 84 87 int maxStackDepth; … … 86 89 87 90 /*! 88 \brief Create a zoomer for a plot canvas. 89 90 The zoomer is set to those x- and y-axis of the parent plot of the 91 canvas that are enabled. If both or no x-axis are enabled, the picker 92 is set to Qwt Plot::xBottom. If both or no y-axis are93 enabled, it is set to Qwt Plot::yLeft.94 95 The zoomer is initialized with a QwtPickerDragRectMachine, 96 the tracker mode is set to QwtPicker::ActiveOnly and the rubber band 97 is set to QwtPicker::RectRubberBand 98 99 \param canvas Plot canvas to observe, also the parent object 100 \param doReplot Call QwtPlot::replot() for the attached plot before initializing 91 \brief Create a zoomer for a plot canvas. 92 93 The zoomer is set to those x- and y-axis of the parent plot of the 94 canvas that are enabled. If both or no x-axis are enabled, the picker 95 is set to QwtAxis::XBottom. If both or no y-axis are 96 enabled, it is set to QwtAxis::YLeft. 97 98 The zoomer is initialized with a QwtPickerDragRectMachine, 99 the tracker mode is set to QwtPicker::ActiveOnly and the rubber band 100 is set to QwtPicker::RectRubberBand 101 102 \param canvas Plot canvas to observe, also the parent object 103 \param doReplot Call QwtPlot::replot() for the attached plot before initializing 101 104 the zoomer with its scales. This might be necessary, 102 105 when the plot is in a state with pending scale changes. 103 106 104 \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase() 105 */ 106 QwtPlotZoomer::QwtPlotZoomer( QWidget *canvas, bool doReplot ):107 QwtPlotPicker( canvas ) 107 \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase() 108 */ 109 QwtPlotZoomer::QwtPlotZoomer( QWidget* canvas, bool doReplot ) 110 : QwtPlotPicker( canvas ) 108 111 { 109 112 if ( canvas ) … … 112 115 113 116 /*! 114 \brief Create a zoomer for a plot canvas. 115 116 The zoomer is initialized with a QwtPickerDragRectMachine, 117 the tracker mode is set to QwtPicker::ActiveOnly and the rubber band 118 is set to QwtPicker ;;RectRubberBand119 120 \param xAxis X axis of the zoomer 121 \param yAxis Y axis of the zoomer 122 \param canvas Plot canvas to observe, also the parent object 123 \param doReplot Call QwtPlot::replot() for the attached plot before initializing 117 \brief Create a zoomer for a plot canvas. 118 119 The zoomer is initialized with a QwtPickerDragRectMachine, 120 the tracker mode is set to QwtPicker::ActiveOnly and the rubber band 121 is set to QwtPicker::RectRubberBand 122 123 \param xAxisId X axis of the zoomer 124 \param yAxisId Y axis of the zoomer 125 \param canvas Plot canvas to observe, also the parent object 126 \param doReplot Call QwtPlot::replot() for the attached plot before initializing 124 127 the zoomer with its scales. This might be necessary, 125 128 when the plot is in a state with pending scale changes. 126 129 127 \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase() 128 */ 129 130 QwtPlotZoomer::QwtPlotZoomer( int xAxis, int yAxis,131 QWidget *canvas, bool doReplot ):132 QwtPlotPicker( xAxis , yAxis, canvas )130 \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase() 131 */ 132 133 QwtPlotZoomer::QwtPlotZoomer( QwtAxisId xAxisId, QwtAxisId yAxisId, 134 QWidget* canvas, bool doReplot ) 135 : QwtPlotPicker( xAxisId, yAxisId, canvas ) 133 136 { 134 137 if ( canvas ) … … 139 142 void QwtPlotZoomer::init( bool doReplot ) 140 143 { 141 d_data = new PrivateData;142 143 d_data->maxStackDepth = -1;144 m_data = new PrivateData; 145 146 m_data->maxStackDepth = -1; 144 147 145 148 setTrackerMode( ActiveOnly ); … … 155 158 QwtPlotZoomer::~QwtPlotZoomer() 156 159 { 157 delete d_data;158 } 159 160 /*! 161 \brief Limit the number of recursive zoom operations to depth. 162 163 A value of -1 set the depth to unlimited, 0 disables zooming. 164 If the current zoom rectangle is below depth, the plot is unzoomed. 165 166 \param depth Maximum for the stack depth 167 \sa maxStackDepth() 168 \note depth doesn't include the zoom base, so zoomStack().count() might be 160 delete m_data; 161 } 162 163 /*! 164 \brief Limit the number of recursive zoom operations to depth. 165 166 A value of -1 set the depth to unlimited, 0 disables zooming. 167 If the current zoom rectangle is below depth, the plot is unzoomed. 168 169 \param depth Maximum for the stack depth 170 \sa maxStackDepth() 171 \note depth doesn't include the zoom base, so zoomStack().count() might be 169 172 maxStackDepth() + 1. 170 */ 173 */ 171 174 void QwtPlotZoomer::setMaxStackDepth( int depth ) 172 175 { 173 d_data->maxStackDepth = depth;176 m_data->maxStackDepth = depth; 174 177 175 178 if ( depth >= 0 ) 176 179 { 177 // unzoom if the current depth is below d_data->maxStackDepth180 // unzoom if the current depth is below m_data->maxStackDepth 178 181 179 182 const int zoomOut = 180 int( d_data->zoomStack.count()) - 1 - depth; // -1 for the zoom base183 m_data->zoomStack.count() - 1 - depth; // -1 for the zoom base 181 184 182 185 if ( zoomOut > 0 ) 183 186 { 184 187 zoom( -zoomOut ); 185 for ( int i = int( d_data->zoomStack.count()) - 1;186 i > int( d_data->zoomRectIndex ); i-- )188 for ( int i = m_data->zoomStack.count() - 1; 189 i > int( m_data->zoomRectIndex ); i-- ) 187 190 { 188 ( void ) d_data->zoomStack.pop(); // remove trailing rects191 ( void )m_data->zoomStack.pop(); // remove trailing rects 189 192 } 190 193 } … … 193 196 194 197 /*! 195 \return Maximal depth of the zoom stack. 196 \sa setMaxStackDepth() 197 */ 198 \return Maximal depth of the zoom stack. 199 \sa setMaxStackDepth() 200 */ 198 201 int QwtPlotZoomer::maxStackDepth() const 199 202 { 200 return d_data->maxStackDepth;201 } 202 203 /*! 204 \return The zoom stack. zoomStack()[0] is the zoom base, 203 return m_data->maxStackDepth; 204 } 205 206 /*! 207 \return The zoom stack. zoomStack()[0] is the zoom base, 205 208 zoomStack()[1] the first zoomed rectangle. 206 209 207 \sa setZoomStack(), zoomRectIndex() 208 */ 209 const QStack< QRectF> &QwtPlotZoomer::zoomStack() const210 { 211 return d_data->zoomStack;212 } 213 214 /*! 215 \return Initial rectangle of the zoomer 216 \sa setZoomBase(), zoomRect() 217 */ 210 \sa setZoomStack(), zoomRectIndex() 211 */ 212 const QStack< QRectF >& QwtPlotZoomer::zoomStack() const 213 { 214 return m_data->zoomStack; 215 } 216 217 /*! 218 \return Initial rectangle of the zoomer 219 \sa setZoomBase(), zoomRect() 220 */ 218 221 QRectF QwtPlotZoomer::zoomBase() const 219 222 { 220 return d_data->zoomStack[0];221 } 222 223 /*! 224 Reinitialized the zoom stack with scaleRect() as base. 225 226 \param doReplot Call QwtPlot::replot() for the attached plot before initializing 223 return m_data->zoomStack[0]; 224 } 225 226 /*! 227 Reinitialized the zoom stack with scaleRect() as base. 228 229 \param doReplot Call QwtPlot::replot() for the attached plot before initializing 227 230 the zoomer with its scales. This might be necessary, 228 231 when the plot is in a state with pending scale changes. 229 232 230 \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot(). 231 */ 233 \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot(). 234 */ 232 235 void QwtPlotZoomer::setZoomBase( bool doReplot ) 233 236 { 234 QwtPlot *plt = plot();237 QwtPlot* plt = plot(); 235 238 if ( plt == NULL ) 236 239 return; … … 239 242 plt->replot(); 240 243 241 d_data->zoomStack.clear();242 d_data->zoomStack.push( scaleRect() );243 d_data->zoomRectIndex = 0;244 m_data->zoomStack.clear(); 245 m_data->zoomStack.push( scaleRect() ); 246 m_data->zoomRectIndex = 0; 244 247 245 248 rescale(); … … 247 250 248 251 /*! 249 \brief Set the initial size of the zoomer. 250 251 base is united with the current scaleRect() and the zoom stack is 252 reinitialized with it as zoom base. plot is zoomed to scaleRect(). 253 254 \param base Zoom base 255 256 \sa zoomBase(), scaleRect() 257 */ 258 void QwtPlotZoomer::setZoomBase( const QRectF &base )259 { 260 const QwtPlot *plt = plot();252 \brief Set the initial size of the zoomer. 253 254 base is united with the current scaleRect() and the zoom stack is 255 reinitialized with it as zoom base. plot is zoomed to scaleRect(). 256 257 \param base Zoom base 258 259 \sa zoomBase(), scaleRect() 260 */ 261 void QwtPlotZoomer::setZoomBase( const QRectF& base ) 262 { 263 const QwtPlot* plt = plot(); 261 264 if ( !plt ) 262 265 return; … … 265 268 const QRectF bRect = base | sRect; 266 269 267 d_data->zoomStack.clear();268 d_data->zoomStack.push( bRect );269 d_data->zoomRectIndex = 0;270 m_data->zoomStack.clear(); 271 m_data->zoomStack.push( bRect ); 272 m_data->zoomRectIndex = 0; 270 273 271 274 if ( base != sRect ) 272 275 { 273 d_data->zoomStack.push( sRect );274 d_data->zoomRectIndex++;276 m_data->zoomStack.push( sRect ); 277 m_data->zoomRectIndex++; 275 278 } 276 279 … … 279 282 280 283 /*! 281 \return Rectangle at the current position on the zoom stack. 282 \sa zoomRectIndex(), scaleRect(). 283 */ 284 \return Rectangle at the current position on the zoom stack. 285 \sa zoomRectIndex(), scaleRect(). 286 */ 284 287 QRectF QwtPlotZoomer::zoomRect() const 285 288 { 286 return d_data->zoomStack[d_data->zoomRectIndex];287 } 288 289 /*! 290 \return Index of current position of zoom stack. 291 */ 289 return m_data->zoomStack[m_data->zoomRectIndex]; 290 } 291 292 /*! 293 \return Index of current position of zoom stack. 294 */ 292 295 uint QwtPlotZoomer::zoomRectIndex() const 293 296 { 294 return d_data->zoomRectIndex;295 } 296 297 /*! 298 \brief Zoom in 299 300 Clears all rectangles above the current position of the 301 zoom stack and pushes the normalized rectangle on it. 302 303 \note If the maximal stack depth is reached, zoom is ignored. 304 \note The zoomed signal is emitted. 305 */ 306 307 void QwtPlotZoomer::zoom( const QRectF &rect )308 { 309 if ( d_data->maxStackDepth >= 0 &&310 int( d_data->zoomRectIndex ) >=d_data->maxStackDepth )297 return m_data->zoomRectIndex; 298 } 299 300 /*! 301 \brief Zoom in 302 303 Clears all rectangles above the current position of the 304 zoom stack and pushes the normalized rectangle on it. 305 306 \note If the maximal stack depth is reached, zoom is ignored. 307 \note The zoomed signal is emitted. 308 */ 309 310 void QwtPlotZoomer::zoom( const QRectF& rect ) 311 { 312 if ( m_data->maxStackDepth >= 0 && 313 int( m_data->zoomRectIndex ) >= m_data->maxStackDepth ) 311 314 { 312 315 return; … … 314 317 315 318 const QRectF zoomRect = rect.normalized(); 316 if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] )317 { 318 for ( uint i = int( d_data->zoomStack.count()) - 1;319 i > d_data->zoomRectIndex; i-- )319 if ( zoomRect != m_data->zoomStack[m_data->zoomRectIndex] ) 320 { 321 for ( uint i = m_data->zoomStack.count() - 1; 322 i > m_data->zoomRectIndex; i-- ) 320 323 { 321 ( void ) d_data->zoomStack.pop();324 ( void )m_data->zoomStack.pop(); 322 325 } 323 326 324 d_data->zoomStack.push( zoomRect );325 d_data->zoomRectIndex++;327 m_data->zoomStack.push( zoomRect ); 328 m_data->zoomRectIndex++; 326 329 327 330 rescale(); … … 332 335 333 336 /*! 334 \brief Zoom in or out 335 336 Activate a rectangle on the zoom stack with an offset relative 337 to the current position. Negative values of offset will zoom out, 338 positive zoom in. A value of 0 zooms out to the zoom base. 339 340 \param offset Offset relative to the current position of the zoom stack. 341 \note The zoomed signal is emitted. 342 \sa zoomRectIndex() 343 */ 337 \brief Zoom in or out 338 339 Activate a rectangle on the zoom stack with an offset relative 340 to the current position. Negative values of offset will zoom out, 341 positive zoom in. A value of 0 zooms out to the zoom base. 342 343 \param offset Offset relative to the current position of the zoom stack. 344 \note The zoomed signal is emitted. 345 \sa zoomRectIndex() 346 */ 344 347 void QwtPlotZoomer::zoom( int offset ) 345 348 { 349 int newIndex; 350 346 351 if ( offset == 0 ) 347 d_data->zoomRectIndex = 0; 352 { 353 newIndex = 0; 354 } 348 355 else 349 356 { 350 intnewIndex =d_data->zoomRectIndex + offset;351 newIndex = q Max( 0, newIndex );352 newIndex = qMin( int( d_data->zoomStack.count() ) - 1, newIndex );353 354 d_data->zoomRectIndex= uint( newIndex );355 }356 357 rescale(); 358 359 Q_EMIT zoomed( zoomRect() );360 } 361 362 /*! 363 \brief Assign a zoom stack 364 365 In combination with other types of navigation it might be useful to 366 modify to manipulate the complete zoom stack. 367 368 \param zoomStack New zoom stack 369 \param zoomRectIndex Index of the current position of zoom stack. 357 newIndex = m_data->zoomRectIndex + offset; 358 newIndex = qBound( 0, newIndex, m_data->zoomStack.count() - 1 ); 359 } 360 361 if ( newIndex != static_cast< int >( m_data->zoomRectIndex ) ) 362 { 363 m_data->zoomRectIndex = newIndex; 364 rescale(); 365 Q_EMIT zoomed( zoomRect() ); 366 } 367 } 368 369 /*! 370 \brief Assign a zoom stack 371 372 In combination with other types of navigation it might be useful to 373 modify to manipulate the complete zoom stack. 374 375 \param zoomStack New zoom stack 376 \param zoomRectIndex Index of the current position of zoom stack. 370 377 In case of -1 the current position is at the top 371 378 of the stack. 372 379 373 \note The zoomed signal might be emitted. 374 \sa zoomStack(), zoomRectIndex() 375 */ 380 \note The zoomed signal might be emitted. 381 \sa zoomStack(), zoomRectIndex() 382 */ 376 383 void QwtPlotZoomer::setZoomStack( 377 const QStack< QRectF> &zoomStack, int zoomRectIndex )384 const QStack< QRectF >& zoomStack, int zoomRectIndex ) 378 385 { 379 386 if ( zoomStack.isEmpty() ) 380 387 return; 381 388 382 if ( d_data->maxStackDepth >= 0 &&383 int(zoomStack.count()) > d_data->maxStackDepth )389 if ( m_data->maxStackDepth >= 0 && 390 zoomStack.count() > m_data->maxStackDepth ) 384 391 { 385 392 return; 386 393 } 387 394 388 if ( zoomRectIndex < 0 || zoomRectIndex > int(zoomStack.count()) )395 if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() ) 389 396 zoomRectIndex = zoomStack.count() - 1; 390 397 391 398 const bool doRescale = zoomStack[zoomRectIndex] != zoomRect(); 392 399 393 d_data->zoomStack = zoomStack;394 d_data->zoomRectIndex = uint( zoomRectIndex );400 m_data->zoomStack = zoomStack; 401 m_data->zoomRectIndex = uint( zoomRectIndex ); 395 402 396 403 if ( doRescale ) … … 402 409 403 410 /*! 404 Adjust the observed plot to zoomRect() 405 406 \note Initiates QwtPlot::replot() 407 */ 411 Adjust the observed plot to zoomRect() 412 413 \note Initiates QwtPlot::replot() 414 */ 408 415 409 416 void QwtPlotZoomer::rescale() 410 417 { 411 QwtPlot *plt = plot();418 QwtPlot* plt = plot(); 412 419 if ( !plt ) 413 420 return; 414 421 415 const QRectF &rect =d_data->zoomStack[d_data->zoomRectIndex];422 const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex]; 416 423 if ( rect != scaleRect() ) 417 424 { … … 440 447 441 448 /*! 442 Reinitialize the axes, and set the zoom base to their scales. 443 444 \param xAxis X axis 445 \param yAxis Y axis 446 */ 447 448 void QwtPlotZoomer::setAx is( int xAxis, int yAxis)449 { 450 if ( xAxis != QwtPlotPicker::xAxis() || yAxis != QwtPlotPicker::yAxis() ) 451 { 452 QwtPlotPicker::setAx is( xAxis, yAxis);449 Reinitialize the axes, and set the zoom base to their scales. 450 451 \param xAxisId X axis 452 \param yAxisId Y axis 453 */ 454 455 void QwtPlotZoomer::setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId ) 456 { 457 if ( xAxisId != QwtPlotPicker::xAxis() || yAxisId != QwtPlotPicker::yAxis() ) 458 { 459 QwtPlotPicker::setAxes( xAxisId, yAxisId ); 453 460 setZoomBase( scaleRect() ); 454 461 } … … 464 471 \note The mouse events can be changed, using 465 472 QwtEventPattern::setMousePattern: 2, 1 466 */ 467 void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent *me )473 */ 474 void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent* me ) 468 475 { 469 476 if ( mouseMatch( MouseSelect2, me ) ) … … 486 493 \note The keys codes can be changed, using 487 494 QwtEventPattern::setKeyPattern: 3, 4, 5 488 */ 489 490 void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent *ke )495 */ 496 497 void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent* ke ) 491 498 { 492 499 if ( !isActive() ) … … 504 511 505 512 /*! 506 Move the current zoom rectangle. 507 508 \param dx X offset 509 \param dy Y offset 510 511 \note The changed rectangle is limited by the zoom base 512 */ 513 Move the current zoom rectangle. 514 515 \param dx X offset 516 \param dy Y offset 517 518 \note The changed rectangle is limited by the zoom base 519 */ 513 520 void QwtPlotZoomer::moveBy( double dx, double dy ) 514 521 { 515 const QRectF &rect =d_data->zoomStack[d_data->zoomRectIndex];522 const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex]; 516 523 moveTo( QPointF( rect.left() + dx, rect.top() + dy ) ); 517 524 } 518 525 519 526 /*! 520 Move the the current zoom rectangle. 521 522 \param pos New position 523 524 \sa QRectF::moveTo() 525 \note The changed rectangle is limited by the zoom base 526 */ 527 void QwtPlotZoomer::moveTo( const QPointF &pos )527 Move the the current zoom rectangle. 528 529 \param pos New position 530 531 \sa QRectF::moveTo() 532 \note The changed rectangle is limited by the zoom base 533 */ 534 void QwtPlotZoomer::moveTo( const QPointF& pos ) 528 535 { 529 536 double x = pos.x(); … … 542 549 if ( x != zoomRect().left() || y != zoomRect().top() ) 543 550 { 544 d_data->zoomStack[d_data->zoomRectIndex].moveTo( x, y );551 m_data->zoomStack[m_data->zoomRectIndex].moveTo( x, y ); 545 552 rescale(); 546 553 } … … 548 555 549 556 /*! 550 \brief Check and correct a selected rectangle 551 552 Reject rectangles with a height or width < 2, otherwise 553 expand the selected rectangle to a minimum size of 11x11 554 and accept it. 555 556 \return true If the rectangle is accepted, or has been changed 557 \brief Check and correct a selected rectangle 558 559 Reject rectangles with a height or width < 2, otherwise 560 expand the selected rectangle to a minimum size of 11x11 561 and accept it. 562 563 \return true If the rectangle is accepted, or has been changed 557 564 to an accepted one. 558 */ 559 560 bool QwtPlotZoomer::accept( QPolygon &pa ) const565 */ 566 567 bool QwtPlotZoomer::accept( QPolygon& pa ) const 561 568 { 562 569 if ( pa.count() < 2 ) 563 570 return false; 564 571 565 QRect rect = QRect( pa [0], pa[int( pa.count() ) - 1]);572 QRect rect = QRect( pa.first(), pa.last() ); 566 573 rect = rect.normalized(); 567 574 … … 584 591 585 592 /*! 586 \brief Limit zooming by a minimum rectangle 587 588 \return zoomBase().width() / 10e4, zoomBase().height() / 10e4 589 */ 593 \brief Limit zooming by a minimum rectangle 594 595 \return zoomBase().width() / 10e4, zoomBase().height() / 10e4 596 */ 590 597 QSizeF QwtPlotZoomer::minZoomSize() const 591 598 { 592 return QSizeF( d_data->zoomStack[0].width() / 10e4,593 d_data->zoomStack[0].height() / 10e4 );594 } 595 596 /*! 597 Rejects selections, when the stack depth is too deep, or 598 the zoomed rectangle is minZoomSize(). 599 600 \sa minZoomSize(), maxStackDepth() 601 */ 599 return QSizeF( m_data->zoomStack[0].width() / 10e4, 600 m_data->zoomStack[0].height() / 10e4 ); 601 } 602 603 /*! 604 Rejects selections, when the stack depth is too deep, or 605 the zoomed rectangle is minZoomSize(). 606 607 \sa minZoomSize(), maxStackDepth() 608 */ 602 609 void QwtPlotZoomer::begin() 603 610 { 604 if ( d_data->maxStackDepth >= 0 )605 { 606 if ( d_data->zoomRectIndex >= uint(d_data->maxStackDepth ) )611 if ( m_data->maxStackDepth >= 0 ) 612 { 613 if ( m_data->zoomRectIndex >= uint( m_data->maxStackDepth ) ) 607 614 return; 608 615 } … … 612 619 { 613 620 const QSizeF sz = 614 d_data->zoomStack[d_data->zoomRectIndex].size() * 0.9999;621 m_data->zoomStack[m_data->zoomRectIndex].size() * 0.9999; 615 622 616 623 if ( minSize.width() >= sz.width() && … … 625 632 626 633 /*! 627 Expand the selected rectangle to minZoomSize() and zoom in 628 if accepted. 629 630 \param ok If true, complete the selection and emit selected signals 634 Expand the selected rectangle to minZoomSize() and zoom in 635 if accepted. 636 637 \param ok If true, complete the selection and emit selected signals 631 638 otherwise discard the selection. 632 639 633 \sa accept(), minZoomSize() 634 \return True if the selection has been accepted, false otherwise 635 */ 640 \sa accept(), minZoomSize() 641 \return True if the selection has been accepted, false otherwise 642 */ 636 643 bool QwtPlotZoomer::end( bool ok ) 637 644 { … … 640 647 return false; 641 648 642 QwtPlot *plot = QwtPlotZoomer::plot();649 QwtPlot* plot = QwtPlotZoomer::plot(); 643 650 if ( !plot ) 644 651 return false; 645 652 646 const QPolygon &pa = selection();653 const QPolygon& pa = selection(); 647 654 if ( pa.count() < 2 ) 648 655 return false; 649 656 650 QRect rect = QRect( pa [0], pa[int( pa.count() - 1 )]);657 QRect rect = QRect( pa.first(), pa.last() ); 651 658 rect = rect.normalized(); 652 659 … … 663 670 return true; 664 671 } 672 673 #include "moc_qwt_plot_zoomer.cpp"
Note:
See TracChangeset
for help on using the changeset viewer.
