Results 1 to 2 of 2

Thread: Zoomer Right Click Makes Data Dissapear

  1. #1
    Join Date
    Jun 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Zoomer Right Click Makes Data Dissapear

    I am using the Zoomer example from stockchart in my own plot example.

    When I right click on the plot, it sets the xScale back to 0 even though my plot is on autoscale and my x-axis is larger than 0.

    This is the zoomer code I'm using:

    class Zoomer: public QwtPlotZoomer
    {
    public:
    Zoomer( QWidget *canvas, bool trackerMode ):
    QwtPlotZoomer( canvas )
    {
    setRubberBandPen( QColor( Qt::darkGreen ) );
    setTrackerMode( trackerMode == true ? QwtPlotPicker::AlwaysOn : QwtPlotPicker::AlwaysOff );
    }

    protected:
    virtual QwtText trackerTextF( const QPointF &pos ) const
    {
    QwtText text( QString("%1 , %2").arg(QString::number(pos.x()), QString::number(pos.y())) );
    text.setColor( Qt::white );

    QColor c = rubberBandPen().color();
    text.setBorderPen( QPen( c ) );
    text.setBorderRadius( 6 );
    c.setAlpha( 170 );
    text.setBackgroundBrush( c );

    return text;
    }
    };

    // LeftButton for the zooming
    // RightButton: zoom out by 1
    // Ctrl+RighButton: zoom out to full size
    // TODO: when the user right clicks on plot, the data dissapears

    zoomer = new Zoomer( canvas, fields.displayTracker );
    zoomer->setMousePattern( QwtEventPattern::MouseSelect2,
    Qt::RightButton, Qt::ControlModifier );
    zoomer->setMousePattern( QwtEventPattern::MouseSelect3,
    Qt::RightButton );

    Has anyone experienced this before or know what could be happening?

    Thanks.

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

    Default Re: Zoomer Right Click Makes Data Dissapear

    Quote Originally Posted by bbjunaid View Post
    When I right click on the plot, it sets the xScale back to 0 even though my plot is on autoscale and my x-axis is larger than 0.
    Any operation of the zoomer disables autoscaling ( it uses QwtPlot::setAxisScale() internally ). Navigating on the zoom stack restores ranges that have been pushed the stack - changing the scales behind the back of the zoomer doesn't have any effect this stack.

    If you want to re-enable autoscaling when unzooming completely you have to do this in application code.

    Uwe

Similar Threads

  1. Zoomer behaviour
    By ccbaci in forum Qwt
    Replies: 3
    Last Post: 14th September 2013, 10:56
  2. text on QPrintPreviewWidget dissapear
    By qt-nubie in forum Newbie
    Replies: 0
    Last Post: 22nd January 2013, 10:51
  3. Parts of plot dissapear during scrolling
    By myzinsky in forum Qwt
    Replies: 5
    Last Post: 3rd July 2012, 08:01
  4. Problem with zoomer
    By alainstgt in forum Qwt
    Replies: 3
    Last Post: 18th April 2012, 09:46
  5. NEED HELP: QSystemTrayIcon QMenu doesn't dissapear
    By codeslicer in forum Qt Programming
    Replies: 5
    Last Post: 10th February 2008, 03:17

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.