Results 1 to 5 of 5

Thread: when i clicked on zoom button the YScale is changed to defult 1000

  1. #1
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question when i clicked on zoom button the YScale is changed to defult 1000

    Hello All ,

    I implimented one Qwtplot application , i would like to zoom the curve which is
    drawn according to my values , the problem is when i click on zoom button
    it is adjusted to 1000 automatically , qwt version is 5.0.1


    what is the Problem for that , pls help me .

    Regards
    Veeru

  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: when i clicked on zoom button the YScale is changed to defult 1000

    If you initialize the zoomer before you initialize the scales the zoomer will be initialized by the default scales ( 0 - 1000.0 ).

    You didn't write how you have organized your code, but I guess all you need to do is to reinitialize the zoomer ( QwtPlotZoomer::setZoomBase() ) after you have changed your scales.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Veeru (29th February 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: when i clicked on zoom button the YScale is changed to defult 1000

    Thanks for you

  5. #4
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: when i clicked on zoom button the YScale is changed to defult 1000

    Quote Originally Posted by Uwe View Post
    If you initialize the zoomer before you initialize the scales the zoomer will be initialized by the default scales ( 0 - 1000.0 ).

    You didn't write how you have organized your code, but I guess all you need to do is to reinitialize the zoomer ( QwtPlotZoomer::setZoomBase() ) after you have changed your scales.

    Uwe
    class Zoomer: public QwtPlotZoomer
    {
    public:
    Zoomer(int xAxis, int yAxis, QwtPlotCanvas *canvas):
    QwtPlotZoomer(xAxis, yAxis, canvas)
    {
    setSelectionFlags(QwtPicker:ragSelection | QwtPicker::CornerToCorner);
    setTrackerMode(QwtPicker::AlwaysOff);
    setRubberBand(QwtPicker::NoRubberBand);

    // RightButton: zoom out by 1
    // Ctrl+RightButton: zoom out to full size

    #if QT_VERSION < 0x040000
    setMousePattern(QwtEventPattern::MouseSelect2,
    Qt::RightButton, Qt::ControlButton);
    #else
    setMousePattern(QwtEventPattern::MouseSelect2,
    Qt::RightButton, Qt::ControlModifier);
    #endif
    setMousePattern(QwtEventPattern::MouseSelect3,
    Qt::RightButton);
    }
    };




    d_zoomer[0] = new Zoomer( QwtPlot::xBottom, QwtPlot::yLeft,
    _plotWidget->_canvas);
    d_zoomer[0]->setRubberBand(QwtPicker::RectRubberBand);
    d_zoomer[0]->setRubberBandPen(QColor(Qt::green));
    d_zoomer[0]->setTrackerMode(QwtPicker::ActiveOnly);
    d_zoomer[0]->setTrackerPen(QColor(Qt::white));

    d_zoomer[1] = new Zoomer(QwtPlot::xBottom, QwtPlot::yLeft,
    _plotWidget->_canvas);

    //QwtPlotPicker is used to set the RubberBand , ,TrackerPen ,DragSelection
    //in the canvas
    _dpicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
    QwtPicker::PointSelection | QwtPicker:ragSelection,
    QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
    _plotWidget->_canvas);
    //Set's the RubberBand as CrossRubberBand
    _dpicker->setRubberBand(QwtPicker::CrossRubberBand);
    //Set's the RubberBandPen to color specified in QColor
    _dpicker->setRubberBandPen(QColor(Qt::green));
    //Set's the TrackerPen to color specified in QColor
    //Tracker pen mean's while we are dragging the mouse on canvas it shows the
    //(X , Y) CoOrdinate's pair according to the position where mouse is placed
    //and it shows continously
    _dpicker->setTrackerPen(QColor(Qt::black));

    connect(_dpicker, SIGNAL(moved(const QPoint &)),
    SLOT(moved(const QPoint &)));


    d_panner = new QwtPlotPanner(_plotWidget->_canvas);
    d_panner->setMouseButton(Qt::MidButton);

    connect(_btnZoom, SIGNAL(toggled(bool)), SLOT(enableZoomMode(bool)));



    void TrafficPlotter::enableZoomMode(bool on)
    {
    d_panner->setEnabled(on);

    d_zoomer[0]->setEnabled(on);
    d_zoomer[0]->zoom(0);

    d_zoomer[1]->setEnabled(on);
    d_zoomer[1]->zoom(0);

    _dpicker->setEnabled(!on);

    }

  6. #5
    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: when i clicked on zoom button the YScale is changed to defult 1000

    This code is not the important one.

    Check, when you initialize your axes ( or if you are using autoscaling, when you trigger it ). Then adjust the zoomBase of your zoomer ( you might need to do a replot() before, to apply the axes changes )

    Uwe

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.