Results 1 to 2 of 2

Thread: Change a QwtPlotZoomer zoom base without rescale if zooming

  1. #1
    Join Date
    May 2011
    Posts
    21
    Thanks
    1
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Change a QwtPlotZoomer zoom base without rescale if zooming

    Hello,

    Is there a way to change the zoom base without rescaling ? Better than this:

    Qt Code:
    1. class PlotZoomer : public QwtPlotZoomer
    2. {
    3. public:
    4. explicit PlotZoomer(QwtPlotCanvas *canvas);
    5.  
    6. void setZoomBase( const QRectF &base );
    7. };
    8.  
    9. PlotZoomer::PlotZoomer(QwtPlotCanvas *canvas) :
    10. QwtPlotZoomer(canvas)
    11. {
    12. }
    13.  
    14. void PlotZoomer::setZoomBase(const QRectF &base)
    15. {
    16. if ( !plot() )
    17. return;
    18. int currentIndex = zoomRectIndex();
    19. QStack<QRectF>* stack = new QStack<QRectF>();
    20. *stack = zoomStack();
    21. stack->replace(0, base);
    22. setZoomStack(*stack, 0);
    23. zoom(currentIndex);
    24. }
    To copy to clipboard, switch view to plain text mode 

    I code an oscilloscope-like which receive data continuously. And I want to add a QwtPlotMagnifier and QwtPlotZoomer. The x scale move to follow data, but if we zoom, the screen should stay "freezed" even if we would be up-to-date when unzooming.

    Sorry for my English

    Edit: My solution works well in fact ^^
    Last edited by Troudhyl; 12th May 2011 at 10:21.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,199
    Thanked 847 Times in 796 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Change a QwtPlotZoomer zoom base without rescale if zooming

    Don't use new for your stack - your code produces memory leaks.

    uwe

  3. The following user says thank you to Uwe for this useful post:

    Troudhyl (13th May 2011)

Similar Threads

  1. Change mouse bindings for qwtplotzoomer
    By ivareske in forum Qwt
    Replies: 5
    Last Post: 22nd January 2019, 09:27
  2. Replies: 3
    Last Post: 10th October 2011, 16:55
  3. NOT zooming childs after parent zoom.
    By alitoh in forum Qt Programming
    Replies: 5
    Last Post: 19th April 2011, 15:27
  4. Replies: 2
    Last Post: 20th August 2010, 18:55
  5. Change base class
    By villy in forum Qt Tools
    Replies: 2
    Last Post: 20th September 2006, 11:26

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.