Results 1 to 5 of 5

Thread: QwtPlotCurve: how to delete/erase/empty the Data?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotCurve: how to delete/erase/empty the Data?

    Hi Uwe,
    thanx for the reply.

    that 's actually what i'm doing now. But with a QVector<double> Data and; curve->setData( Data1 ); and overwriting it with new Data..

    The Question is:
    1) If Data1 has 100 Entries and Data2 has less entries, eg. Data2[20] ; curve->setData( Data2 ) what does happen? Are the last 80 Entries the Old Data?

    2) Or is the Memory, which was first located for 100 Entries now freed? Or are 80 Entries reserved with 0.0
    ( I have really big Data...) i'm going to debug 1) + 2)..

    3) If you suggest with curve->setData(QwtArray<QwtDoublePoint>());, a simple overwrite, i have to overwerite the whole size of the Array with "0.0" for doing the clear() job?

    Background:
    I'm using CZoomer for zooming and i'm loading several Data1,2,3,.... in QwtPlot MyPlot two QwtPlotCurve MyCurve1 and QwtPlotCurve MyCurve2.
    And for unknown reasons the Data i've erased from MyCurve, is sudden visible again if i zoom out? Maybe it's an CZoomer problem, but i was thinking, that it is because of QwtPlotCurve has no nice clear() Funktion?


    greetings Astronomy
    Last edited by Astronomy; 15th January 2010 at 16:43.

  2. #2
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotCurve: how to delete/erase/empty the Data?

    Ah i just found out:
    So SetData does make a total clearance if new data is inserted.

    void QwtPlotCurve::setData(const QPolygonF &data)
    #endif
    {
    delete d_xy;
    d_xy = new QwtPolygonFData(data);
    itemChanged();
    }

    or

    void QwtPlotCurve::setData(const QwtData &data)
    {
    delete d_xy;
    d_xy = data.copy();
    itemChanged();
    }

  3. #3
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotCurve: how to delete/erase/empty the Data?

    Thanks to Uwe the trick with: curve->setData(QwtArray<QwtDoublePoint>());
    worked.

    I do not quite understand why ::setData(const QPolygonF &data) needs a new operator in the implementation and ::setData(const QwtData &data) below not. As i know, after each delete must follow a new operator? But as long as it works it should not bother me (-;

    regards A.

Similar Threads

  1. Empty SQL Data from ODBC/FreeTDS
    By dentharg in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2009, 07:50
  2. Erase menubar
    By lixo1 in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2009, 16:04
  3. Replies: 2
    Last Post: 18th December 2008, 07:43
  4. help using QLists as data in QwtPlotCurve
    By esorensen in forum Qwt
    Replies: 1
    Last Post: 11th July 2008, 19:52
  5. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 07:30

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.