Results 1 to 3 of 3

Thread: QwtPlot example using a fixed aspect ratio zoomer?

  1. #1
    Join Date
    Apr 2011
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QwtPlot example using a fixed aspect ratio zoomer?

    Would anyone have an example of a QwtPlot that uses both a QwtPlotZoomer to give rubber band zooming and a QwtPlotRescaler to maintain a fixed aspect ratio?

    Used independently, Rescaler and Zoomer work fine. I would like to combine them so that the axes maintain a fixed aspect ratio within the zoomer rubber band rectangle, but I can't seem to get it right...

  2. #2
    Join Date
    Apr 2011
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot example using a fixed aspect ratio zoomer?

    No replies to my question, so I did it myself by sub-classing QwtPlot and implementing a void Plot::rescale(QRectF &); function that adjusts the scales to keep a fixed aspect ratio.

    That rescale function is then called from void Plot::resizeEvent(QResizeEvent *e);
    and also from void MyPlotZoomer::zoom( const QwtDoubleRect & rect );

    The code is attached.

    Maybe there is a better way using QwtPlotRescaler ... but I couldn't do it
    Attached Files Attached Files

  3. #3
    Join Date
    Apr 2011
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot example using a fixed aspect ratio zoomer?

    that zip file seems to have been silently emptied (perhaps by our firewall?). Although its showing 2.2kb ? Anyway, here are the three files attached separately.
    Attached Files Attached Files

  4. The following user says thank you to nige for this useful post:

    steve123 (18th May 2011)

Similar Threads

  1. Replies: 7
    Last Post: 18th November 2016, 11:48
  2. How to get aspect ratio on selection with rubberBand?
    By suseway in forum Qt Programming
    Replies: 6
    Last Post: 25th October 2010, 08:29
  3. keeping aspect ratio while resizing
    By franco.amato in forum Qt Programming
    Replies: 2
    Last Post: 19th November 2009, 20:12
  4. Preserving aspect ratio of image
    By Banjo in forum Qt Programming
    Replies: 2
    Last Post: 16th January 2009, 13:39
  5. QProcess+mPlayer+Aspect Ratio
    By IGHOR in forum Qt Programming
    Replies: 0
    Last Post: 22nd March 2008, 03:14

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.