Results 1 to 2 of 2

Thread: It is a possible to disable QwtPlot autoscaling of contents?

  1. #1
    Join Date
    Jul 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default It is a possible to disable QwtPlot autoscaling of contents?

    I want to disable contents autoscaling of QwtPlot, but i don't know how do this.

    I wrote a simple hack for this:
    Qt Code:
    1. class Plot : public QwtPlot
    2.  
    3. ...
    4.  
    5. bool Plot::eventFilter(QObject* o, QEvent* e)
    6. {
    7. if (o == canvas())
    8. {
    9. if (e->type() == QEvent::Resize)
    10. {
    11. QResizeEvent* re = static_cast<QResizeEvent*> (e);
    12. setAxisScale(QwtPlot::xBottom, 0, re->size().width());
    13. setAxisScale(QwtPlot::yLeft, 0, re->size().height());
    14. replot();
    15. }
    16. }
    17.  
    18. return QwtPlot::eventFilter(o, e);
    19. }
    To copy to clipboard, switch view to plain text mode 
    But it looks ugly (

    This screenshots points to what i mean:
    my_needs.jpg

    What can i do?

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

    Default Re: It is a possible to disable QwtPlot autoscaling of contents?

    Your code assigns widget coordinates as plot coordinates ...

    The easiest way to disable autoscaling ( what is not what you mean by autoscaling ! ) is to assign a scale. But you are looking for QwtPlotRescaler. Check the navigation example - the second combo box should do what you need.

    Note that it is not always possible to have a fixed aspect ratio for the plot canvas. The problem here is a ping-pong effect between the adjustments of the scales ( according to the size of the canvas ) and the space that is needed for the resulting tick labels, that might modify the size that is left for the canvas.

    Uwe

Similar Threads

  1. QScrollArea clipping contents
    By tiredtyrant in forum Qt Programming
    Replies: 0
    Last Post: 11th February 2010, 18:16
  2. TabWidget not showing contents
    By jpsisko in forum Qt Programming
    Replies: 1
    Last Post: 28th October 2009, 16:55
  3. Replies: 6
    Last Post: 14th May 2009, 12:02
  4. listing derectory contents
    By ramamurthy.kv in forum Qt Programming
    Replies: 9
    Last Post: 5th May 2008, 19:59
  5. How can i get the contents size of QTextBrowser
    By m_e in forum Qt Programming
    Replies: 4
    Last Post: 25th December 2006, 14: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.