Invalid use of non-static member function



  • Hello,

    I am programming on Qt 5.9.0 with QCustomPlot to draw graphs.

    Everything was working fine, when suddenly QT Creator said : Invalid use of non-static member function.

    Here's portions of my code. Another class with almost the same code is working fine.

    // MainWindow.cpp
     
     
    // code
     
    nfgraph *graph = new nfgraph(x,y,a,b,c,d,e,g,h,j,this); // Error here. Letters are QVectors
    graph->show();
     
    // code
     
    nbgraph *bg = new nbgraph(x,y,this); // Another class, called the same way, but working
    bg->show();
     
    // code
    
    
    // nfgraph.h
     
    class nfgraph : public QDialog   // not working class
    {
            Q_OBJECT
     
        public:
            explicit nfgraph(QVector<double> x,QVector<double> y,QVector<double> a,QVector<double> b,QVector<double> c,QVector<double> d,QVector<double> e,QVector<double> f,QVector<double> g,QVector<double> h,QWidget *parent=0);
            ~nfgraph();
    //...
    
    // nfgraph.cpp
     
    nfgraph::nfgraph(QVector<double> x,QVector<double> y,QVector<double> a,QVector<double> b,QVector<double> c,QVector<double> d,QVector<double> e,QVector<double> f,QVector<double> g,QVector<double> h,QWidget *parent) :QDialog(parent),ui(new Ui::nfgraph)
    {
        ui->setupUi(this);
    ...
    
    //nbgraph.h
     
    class nbgraph : public QDialog // Another class but working fine
    {
            Q_OBJECT
     
        public:
            explicit nbgraph(QVector<double>,QVector<double>,QWidget *parent=0);
    ...
    
    
    //nbgraph.cpp
     
    nbgraph::nbgraph(QVector<double> x,QVector<double> y, QWidget *parent) :QDialog(parent),ui(new Ui::nbgraph)
    {
        ui->setupUi(this);
    ...
    
    

    The error appeared when I added QVectors to my nfgraph constructor (was (x,y,this) before). After that, even deleting them didn't solve my problem.

    I tried making a method draw(...) taking my QVectors : default constructor nfgraph *graph = new nfgraph(); then graph->draw(QVectors...) but didn't solve my error either.

    Thanks in advance for anything than can help me, and sorry for my bad english!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show the complete error log ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.