Results 1 to 3 of 3

Thread: zoomer changes default axisscale vakues after Home key in a Qwtplot

  1. #1
    Join Date
    Jul 2014
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default zoomer changes default axisscale vakues after Home key in a Qwtplot

    Hi

    I set my axes like

    const QwtInterval xInterval = m_spectrogram->data()->interval( Qt::XAxis );
    setAxisScale(xBottom, xInterval.minValue(), xInterval.maxValue(), 20);

    const QwtInterval yInterval = m_spectrogram->data()->interval( Qt::YAxis );
    setAxisScale(yLeft, yInterval.minValue(), yInterval.maxValue(), 5);

    then I setup my zoomer

    if(!m_zoomer)
    {
    m_zoomer = new MyZoomer(canvas());
    }

    m_zoomer->setKeyPattern( QwtEventPattern::KeyHome, Qt::Key_Home);

    The plot has the X, Y axes I want when it starts but after zooming and returning to the default view through the Home key the axes do not return to the setting above.

    This is all being done in a class derived from QwtPlot like in the Qwt examples.

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

    Default Re: zoomer changes default axisscale vakues after Home key in a Qwtplot

    In cases where you don't create the zoomer - probably all beside the first one - you have to reinitialize the zoom base:

    Qt Code:
    1. m_zoomer->setZoomBase( true );
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. #3
    Join Date
    Jul 2014
    Posts
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: zoomer changes default axisscale vakues after Home key in a Qwtplot

    Hi Uwe, thanks again for your response.

    Here is what I have done and it works.

    void MySurfacePlott::keyReleaseEvent(QKeyEvent *event)
    {
    if (event->key() == Qt::Key_Home)
    {
    const QwtInterval xInterval = m_spectrogram->data()->interval( Qt::XAxis );
    setAxisScale(xBottom, xInterval.minValue(), xInterval.maxValue(), 20);

    const QwtInterval yInterval = m_spectrogram->data()->interval( Qt::YAxis );
    setAxisScale(yLeft, yInterval.minValue(), yInterval.maxValue(), 5);

    m_zoomer->setZoomBase( true );

    }

    QwtPlot::keyReleaseEvent(event);
    }

Similar Threads

  1. Replies: 1
    Last Post: 18th June 2014, 08:23
  2. Replies: 3
    Last Post: 15th January 2014, 07:52
  3. Replies: 6
    Last Post: 17th January 2012, 09:04
  4. Replies: 2
    Last Post: 20th April 2011, 12:47
  5. How to get default home page of internet browser
    By sam_er83 in forum Qt Programming
    Replies: 2
    Last Post: 14th September 2009, 07:29

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
  •  
Qt is a trademark of The Qt Company.