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. How can i solve no matching member function for call to 'append' ??
Forum Updated to NodeBB v4.3 + New Features

How can i solve no matching member function for call to 'append' ??

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 5.8k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    deleted286
    wrote on last edited by
    #1

    Hi guys. I got an error in series-> append part. It says no matching member function for call to append. How can i solve it?

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QFile>
    #include <QTextStream>
    #include <QtCharts/QLineSeries>
    #include <QtCharts/qlineseries.h>
    #include <QLine>
    #include <qline.h>
    
    using namespace QtCharts;
    
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    void MainWindow::on_pushButton_2_clicked()
    {
    
    
         QLineSeries *series = new QLineSeries();
    
         QFile file("C:/Users/ilknu/Documents/Dendennnnden/ornek.txt");
         if(file.open(QIODevice::ReadOnly)) {
            QTextStream in (&file);
            while(!in.atEnd()) {
                QString line = in.readLine();
                QStringList list = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
                for(const QString &entry : list) {
                double num = entry.toDouble();
                series->append(num);
            }
        }
    }
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      @suslucoder said in How can i solve no matching member function for call to 'append' ??:

      double num = entry.toDouble();
      series->append(num);

      Please, read the documentation, there's no append overload which takes a double.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi,

        @suslucoder said in How can i solve no matching member function for call to 'append' ??:

        double num = entry.toDouble();
        series->append(num);

        Please, read the documentation, there's no append overload which takes a double.

        D Offline
        D Offline
        deleted286
        wrote on last edited by
        #3

        @SGaist I saw that series take 2 argumants like series->append(0,6);
        But it gives me the same error.
        What is the problem here

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Please show your current code and the exact error.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          0
          • SGaistS SGaist

            Please show your current code and the exact error.

            D Offline
            D Offline
            deleted286
            wrote on last edited by
            #5

            @SGaist Here is the current code

            #include "mainwindow.h"
            #include "ui_mainwindow.h"
            #include <QFile>
            #include <QTextStream>
            #include <QMessageBox>
            #include <QTimer>
            #include <QList>
            #include <qlist.h>
            #include <QDebug>
            #include <QtCharts/QLineSeries>
            #include <QtCharts/QChart>
            #include <QtCharts/QDateTimeAxis>
            #include <QDateTime>
            #include <QtCharts/QValueAxis>
            #include <QtCharts/QChartView>
            #include <QLine>
            #include <QString>
            
            
            QT_CHARTS_USE_NAMESPACE
            using namespace QtCharts;
            
            QTimer *timer = new QTimer();
            
            
            
            
            MainWindow::MainWindow(QWidget *parent)
                : QMainWindow(parent)
                , ui(new Ui::MainWindow)
            {
                ui->setupUi(this);
            
            
            
                connect(timer, SIGNAL(timeout()), SLOT(Timer_Slot()));
            
            }
            
            
            void MainWindow::Timer_Slot() {
            
               QString line = allLines[curIndex];
              ui->plainTextEdit->setPlainText(line);
              if (curIndex < allLines.size() - 1 ) {
                      curIndex++;
               }
            
            
            
            }
            
            
            
            
            MainWindow::~MainWindow()
            {
                delete ui;
            }
            
            
            void MainWindow::on_pushButton_2_clicked()  //write
            {
                QFile file("C:/Users/ilknu/Documents/QFileDemo/abc.txt");
                if(!file.open(QFile::WriteOnly | QFile::Text )) {
            
                    QMessageBox::warning(this, "title", "file not open");
            
            
                }
            
                QTextStream out (&file);
                QString text = ui->plainTextEdit->toPlainText();
                out << text;
                file.flush();
                file.close();
            
            
            }
            
            void MainWindow::on_pushButton_clicked()  //read
            {
            
                QLineSeries *series = new QLineSeries();
            
                QFile file("C:/Users/ilknu/Documents/QFileDemo/abc.txt");
                 if (file.open(QIODevice::ReadOnly)) {
                     QTextStream in (&file);
                     while (!in.atEnd()) {
                         //QString line = in.readLine();
                         //allLines.append(line);
            
                         QString line = in.readLine();
                         allLines.append(line);
            
                         QStringList list = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
                         for(const QString &entry : list) {
                         double num = entry.toDouble();
            
                      qDebug()<<num;
            
            series->append(num);
            
                         }
            
            
                     }
            
            
            
            }
            
            
            
              file.close();
              curIndex=0;
              timer->start(200);
            
            
            }
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @suslucoder said in How can i solve no matching member function for call to 'append' ??:

              series->append(num);

              That line is still wrong. The append method takes two arguments representing a coordinate or one that is a QPointF or finally a list of QPointF.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              3

              • Login

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