Results 1 to 4 of 4

Thread: Segfault when calling setAxisScaleEngine more than 2 times

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Default Re: Segfault when calling setAxisScaleEngine more than 2 times

    I presume QwtPlot takes ownership of the scale engine after the call to setAxisScaleEngine. This sort of thing is standard behaviour with Qt, so I would say it is logical in this context.

    Having said that, the Qt documentation is very explicit about when ownership of an object is and is not transferred. The Qwt documentation should be updated to be very explicit about when this does and does not occur.

  2. #2
    Join Date
    Nov 2008
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: Segfault when calling setAxisScaleEngine more than 2 times

    Jord,
    So what should one do to address or circumvent the behaviour? In my case, the call works only in Mac OS and not in Linux, the second call to either change the scale between Linear and Log, or change the Min and Max values is called as show here:
    Qt Code:
    1. calibPlot->setAxisScale(QwtPlot::xBottom, xMinVal.toInt(&ok,10),axisXEnd->text().toInt(&ok,10) );
    To copy to clipboard, switch view to plain text mode 
    When called to change the Scale:
    Qt Code:
    1. void CentralPage::xAxisScaleChange( const QString &xAxisScaleType)
    2. {
    3. if (xAxisScaleType == "[X]Linear") {
    4. calibPlot->setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine ());
    5. calibPlot->replot();
    6. } else {
    7. calibPlot->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine());
    8. calibPlot->replot();
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 5
    Last Post: 6th March 2007, 06:34

Tags for this Thread

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.