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
Forum Update on Monday, May 27th 2025

Function call problem

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 426 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.
  • Z Offline
    Z Offline
    Zgembo
    wrote on 19 Mar 2019, 07:29 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?
    
    A 1 Reply Last reply 19 Mar 2019, 08:17
    0
    • Z Zgembo
      19 Mar 2019, 07:29

      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?
      
      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 19 Mar 2019, 08:17 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.

      Z 1 Reply Last reply 19 Mar 2019, 08:49
      3
      • A aha_1980
        19 Mar 2019, 08:17

        @Zgembo

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

        Z Offline
        Z Offline
        Zgembo
        wrote on 19 Mar 2019, 08:49 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 :-)

        A 1 Reply Last reply 19 Mar 2019, 09:36
        0
        • Z Zgembo
          19 Mar 2019, 08:49

          @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 :-)

          A Offline
          A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on 19 Mar 2019, 09:36 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

          1/4

          19 Mar 2019, 07:29

          • Login

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