Results 1 to 2 of 2

Thread: help using QLists as data in QwtPlotCurve

  1. #1
    Join Date
    Jul 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default help using QLists as data in QwtPlotCurve

    Hi,

    I have 2 QLists that I would like to use as the data in a QwtPlot.
    (xList, yList)

    I see that QwtPlotCurve has several methods for setData;

    void setData (const double *xData, const double *yData, int size)
    void setData (const QwtArray< double > &xData, const QwtArray< double > &yData)
    void setData (const QPolygonF &data)void setData (const QwtData &data)

    Simply trying

    pCurve->setData( Data->xList, Data->yList );

    produces the error

    error: no matching function for call to
    'QwtPlotCurve::setData(const QList<double>&, const QList<double>&)'


    It looks like I should be able to use the method

    void setData (const QwtArray< double > &xData, const QwtArray< double > &yData)

    if I were smart enough.

    Is there an easy / inexpensive way to use my existing QLists as the data?

    Thanks for any help.

    es

  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: help using QLists as data in QwtPlotCurve

    QList might be the right solution for your situation, but in general its a bad decision for storing large datasets of doubles. That's why tere is no QwtData class that is tailored for it.

    If you really need fast insertion/removals in your data-sets ( that's what QList is good for ) and want to stay with QList I recommend to derive your own QwtListData class. Simply copy QwtArrayData and replace QwtArray by QList.

    Uwe

Similar Threads

  1. Replies: 6
    Last Post: 17th June 2008, 07:28
  2. Replies: 4
    Last Post: 19th October 2007, 19:47
  3. Data model
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2007, 12:14
  4. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.