Results 1 to 2 of 2

Thread: Moving on canvas only in range of curves

  1. #1
    Join Date
    Oct 2015
    Posts
    50
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Moving on canvas only in range of curves

    Hi,

    I have got a few questions:

    - I use a QwtPlotPanner to move on the canvas with the left Button. Is it possible to move through the canvas with the arrow keys on my keyboard?
    Qt Code:
    1. QwtPlotPanner *plotPanner = new QwtPlotPanner(plot->canvas()); //Panning with right Button
    2. plotPanner->setMouseButton(Qt::LeftButton);
    To copy to clipboard, switch view to plain text mode 
    - Can I set something like a limit on my axis, so the user can't move away from the curves? This also would be nice for zooming in and out

    - I want to set two VLineRubberBand which I can move through the graph. I can do this with a QwtPlotPicker, but how do I leave the RubberBand on a certain position? Maybe you can advise me to some example.

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

    Default Re: Moving on canvas only in range of curves

    I use a QwtPlotPanner to move on the canvas with the left Button. Is it possible to move through the canvas with the arrow keys on my keyboard?.
    You would have to overload QwtPlotPanner overloading the key event handling. But usually you want to do one of the following:

    Qt Code:
    1. void shiftAxis( QwtPlot* plot, int axis, double increment )
    2. {
    3. QwtInterval interval = plot->axisInterval( axis );
    4. plot->setAxisScale( axis, interval.minValue() + increment, interval.maxValue() + increment );
    5. }
    6.  
    7. void shiftAxis( QwtPlot* plot, int axis, in numPixels )
    8. {
    9. QwtScaleMap map = plot->canvasMap( axis );
    10. QwtInterval interval = plot->axisInterval( axis );
    11.  
    12. double min = map.invTransform( map.transform( interval.minValue() ) + numPixels );
    13. double max = map.invTransform( map.transform( interval.maxValue() ) + numPixels );
    14.  
    15. plot->setAxisScale( min, max );
    16. }
    To copy to clipboard, switch view to plain text mode 

    Can I set something like a limit on my axis, so the user can't move away from the curves?
    You would have to overload QwtPlotPanner::moveCanvas().

    I want to set two VLineRubberBand which I can move through the graph. I can do this with a QwtPlotPicker, but how do I leave the RubberBand on a certain position?
    Insert 2 markers ( QwtPlotMarker::VLine ) and hide them, when the corresponding picker is active.

    Uwe

Similar Threads

  1. QwtSlider with zero range
    By Induriel in forum Qwt
    Replies: 6
    Last Post: 29th October 2015, 19:44
  2. QDoubleVlaidator range
    By johnmauer in forum Qt Programming
    Replies: 1
    Last Post: 20th October 2010, 17:08
  3. Replies: 0
    Last Post: 24th May 2010, 13:19
  4. QLineEdit set min max range?
    By whitefurrows in forum Qt Programming
    Replies: 29
    Last Post: 11th June 2006, 00:51
  5. Elements out of Range!!
    By Kapil in forum Newbie
    Replies: 9
    Last Post: 3rd April 2006, 11:28

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.