Results 1 to 3 of 3

Thread: QwtPlot->axisScaleDiv does not update after detaching curve

  1. #1
    Join Date
    Sep 2015
    Posts
    36
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default QwtPlot->axisScaleDiv does not update after detaching curve

    So, my code is like this there:

    Qt Code:
    1. qDebug()<< "Lower bound before detach: " << this->axisScaleDiv(0).lowerBound() << " Upper bound before detach: " << this->axisScaleDiv(0).upperBound();
    2.  
    3. curves[signalID]->detach();
    4.  
    5. this->updateAxes();
    6.  
    7. qDebug()<< "Lower bound after detach: " << this->axisScaleDiv(0).lowerBound() << " Upper bound after detach: " << this->axisScaleDiv(0).upperBound();
    To copy to clipboard, switch view to plain text mode 

    Lower bound before detach: -50 Upper bound before detach: 300
    Lower bound after detach: -50 Upper bound after detach: 300

    curves is a vector of plot curve pointers, as I can have very large number of these.

    And here is algorithm causing that bug:

    1. I use my own zoomer class inheriting QwtPlotZoomer, but there is nothing else than overriding mouse event, which actually does nothing at all (pushes event to default).
    2. I order my plot to show me two curves like this:
    plots.jpg
    3. I use zoomer to zoom plot (zoomer is supposed to update it's zoomBase from lower and upper bounds of QwtPlot->axisScaleDiv every time new curve is added and axes are updated, and it does that).
    4. I click RMB to get back to previous state.
    5. Now I want to hide one of the curves again so I click my checkbox meaning, that I want this curve to detach. And it detaches, but scale is not recalculated:

    Plot2.jpg

    I thought at first, that zoomer is causing it with having old zoomerBase. But even if I set base manually to 0,0,1,1 before detaching nothing changes. Base has no meaning at all because I don't click RMB on plot.

    Bug(?) does not appear when I don't use zoomer (it rescales correctly). I can attach and detach any curve and left scale will always rescale itself. If I attach new curve to current plot after going back to zoomBase - it will still recalculate scales (if scale of new curve is bigger than others). It appears ONLY when I detach curve after returning to zoom base. If I click any checkbox again after "bug" appears program will start to behave like zoomer was never used until I do everything above again.

    Also if I detach curve while zoomed - return to base works incorrectly (I have to manually return to base before detaching, scale is still wrong, but at least visible as it should be)
    Last edited by Khaine; 30th March 2016 at 19:45.

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

    Default Re: QwtPlot->axisScaleDiv does not update after detaching curve

    As soon as you use a zoomer autoscaling gets turned off ( you are controlling the scales manually then - see QwtPlot::setAxisScale() ). Once autoscaling is off, there is no reason for updating the scales, when detaching a curve.
    So you need to re-enable autoscaling manually, when you don't want the zoomer being in control anymore.

    HTH,
    Uwe

  3. #3
    Join Date
    Sep 2015
    Posts
    36
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QwtPlot->axisScaleDiv does not update after detaching curve

    Yes, that fixed this particular problem. Unfortunately I still have one connected to zoomer.

    I have one thread being used exclusively for picking samples. Currently it has two modes - normal and "from zoomer". Normal mode is set to take samples from 0 to end (we display them for the first time), then it activates the slot in class inheriting QwtPlot, sets samples for curves and attaches curves to it. It works fine. But when it comes to zoomer weird things are happening. When is actually zoomer's "rescale" method called? I have feeling that it's called more often than only when I use zoomer to zoom or unzoom area.

    What is more important - how can I reset zoom stack without multiple zoom -1 requests?
    Last edited by Khaine; 1st April 2016 at 01:40.

Similar Threads

  1. qwtplot curve orientation problem
    By tangtao_xp in forum Qwt
    Replies: 2
    Last Post: 27th April 2013, 16:27
  2. Qwtplot curve not shown
    By claudiacrb in forum Qwt
    Replies: 1
    Last Post: 9th June 2012, 09:56
  3. how to create a curve in qwtplot?
    By ethanfeng in forum Qwt
    Replies: 1
    Last Post: 27th March 2011, 10:05
  4. Replies: 1
    Last Post: 13th March 2010, 09:55
  5. Replies: 1
    Last Post: 9th December 2009, 18: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.