Results 1 to 2 of 2

Thread: QList of QwtPlotCurve s | remove QwtPlotCurve from QwtPlot

  1. #1
    Join Date
    Apr 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QList of QwtPlotCurve s | remove QwtPlotCurve from QwtPlot

    I would like to make a QList of QwtPlotCurve s. The reason for this is to be able to remove them later form my QwtPlot. I have the following code:

    Qt Code:
    1. QList<QwtPlotCurve> myList = new QList<QwtPlotCurve>;
    2. QwtPlotCurve* curve1 = new QwtPlotCurve();
    3. QwtPlotCurve* curve2 = new QwtPlotCurve();
    4. curves->append(curve1);
    5. curves->append(curve2);
    To copy to clipboard, switch view to plain text mode 

    The code doesn't compile and the compiler outputs:

    error: conversion from 'QList' to non-scalar type 'QList' requested

    error: no matching function for call to 'QList::append(QwtPlotCurve&)' void QList::append(const T&) [with T = QwtPlotCurve]

    note: candidates are:

    note: void QList::append(const T&) [with T = QwtPlotCurve]

    note: no known conversion for argument 1 from 'QwtPlotCurve*' to 'const QwtPlotCurve&'

    note: void QList::append(const QList&) [with T = QwtPlotCurve]

    note: no known conversion for argument 1 from 'QwtPlotCurve*' to 'const QList&'

    ...

    It says the QwtPlotCurve should be constant, but I don't know how to deal with it. I don't know neither whether storing curves in a QList and then removing it (on user demand) from the plot is the right approach.

  2. #2
    Join Date
    Apr 2011
    Location
    Bayreuth, Bayern
    Posts
    24
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QList of QwtPlotCurve s | remove QwtPlotCurve from QwtPlot

    Change
    Qt Code:
    1. QList<QwtPlotCurve> myList = new QList<QwtPlotCurve>;
    To copy to clipboard, switch view to plain text mode 
    to
    Qt Code:
    1. QList<QwtPlotCurve*> myList = new QList<QwtPlotCurve*>;
    To copy to clipboard, switch view to plain text mode 
    You are declaring pointers, but you are trying to store them to a list of objects.

Similar Threads

  1. QwtPlotCurve
    By kishorer in forum Newbie
    Replies: 0
    Last Post: 6th September 2011, 16:05
  2. Replies: 1
    Last Post: 13th July 2011, 08:55
  3. Replies: 1
    Last Post: 9th December 2009, 17:14
  4. QwtPlotCurve Selection
    By WXNSNW in forum Qwt
    Replies: 1
    Last Post: 5th August 2009, 07:41
  5. Replies: 2
    Last Post: 7th July 2009, 07:44

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.