Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Function call problem

Function call problem

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 422 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ZgemboZ Offline
    ZgemboZ Offline
    Zgembo
    wrote on last edited by
    #1

    Hi all,

    I am working with QCustomPlot graph and I am trying to add data to plot.

    I am trying to copy data from one plot to another in this way:

    //fetch data 
    QVector<double> *xDataToPlot = getTraces().at(i)->getXData();
    QList<float> *yDataToPlot = getTraces().at(i)->getYData();
    
    //add data to new graph
    printScreen->getTraces().at(i)->getGraph()->addData(xDataToPlot, yDataToPlot);
    

    I can not compile this part of code.
    Function addData is QCustomPlot function that is tefined as:

    void QCPGraph::addData ( const QVector< double > &  	keys,
    		const QVector< double > &  	values,bool  	alreadySorted = false 
    
    void QCPGraph::addData ( double  key,double  value )
    
    It can be found here https://www.qcustomplot.com/documentation/classQCPGraph.html#ae0555c0d3fe0fa7cb8628f88158d420f
    
    Any suggestions?
    
    aha_1980A 1 Reply Last reply
    0
    • ZgemboZ Zgembo

      Hi all,

      I am working with QCustomPlot graph and I am trying to add data to plot.

      I am trying to copy data from one plot to another in this way:

      //fetch data 
      QVector<double> *xDataToPlot = getTraces().at(i)->getXData();
      QList<float> *yDataToPlot = getTraces().at(i)->getYData();
      
      //add data to new graph
      printScreen->getTraces().at(i)->getGraph()->addData(xDataToPlot, yDataToPlot);
      

      I can not compile this part of code.
      Function addData is QCustomPlot function that is tefined as:

      void QCPGraph::addData ( const QVector< double > &  	keys,
      		const QVector< double > &  	values,bool  	alreadySorted = false 
      
      void QCPGraph::addData ( double  key,double  value )
      
      It can be found here https://www.qcustomplot.com/documentation/classQCPGraph.html#ae0555c0d3fe0fa7cb8628f88158d420f
      
      Any suggestions?
      
      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Zgembo

      It seems, for keys you can just use *xDataToPlot, but for values you need to transform the QList<float> to a QVector<double>.

      Qt has to stay free or it will die.

      ZgemboZ 1 Reply Last reply
      3
      • aha_1980A aha_1980

        @Zgembo

        It seems, for keys you can just use *xDataToPlot, but for values you need to transform the QList<float> to a QVector<double>.

        ZgemboZ Offline
        ZgemboZ Offline
        Zgembo
        wrote on last edited by
        #3

        @aha_1980 said in Function call problem:

        @Zgembo

        It seems, for keys you can just use *xDataToPlot, but for values you need to transform the QList<float> to a QVector<double>.

        Thank you. I have been looking at this since last night :-)

        aha_1980A 1 Reply Last reply
        0
        • ZgemboZ Zgembo

          @aha_1980 said in Function call problem:

          @Zgembo

          It seems, for keys you can just use *xDataToPlot, but for values you need to transform the QList<float> to a QVector<double>.

          Thank you. I have been looking at this since last night :-)

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Zgembo

          I don't know QCustomPlot, but it seems a bit strange API-wise to return a QList<float> at one place and require a QVector<double> at another...

          Qt has to stay free or it will die.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved