title: Qt C++ cannot call member function ' ' without object
body: <p>I keep getting this error:</p>
  
  <pre><code>cannot call member function 'QString Load::loadRoundsPlayed()'without object
  </code></pre>
  
  <p>Now im pretty new to c++ and qt so im not sure what this means. I am trying to call a function from another class to set the number on some lcdNumbers. Here is the Load.cpp which holds the function:</p>
  
  <pre><code>#include "load.h"
  #include &lt;QtCore&gt;
  #include &lt;QFile&gt;
  #include &lt;QDebug&gt;
  
  Load::Load() //here and down
  {}
  
  QString Load::loadRoundsPlayed()
  {
      QFile roundsFile(":/StartupFiles/average_rounds.dat");
  
      if(!roundsFile.open(QFile::ReadOnly | QFile::Text))
      {
          qDebug("Could not open average_rounds for reading");
      }
  
      Load::roundsPlayed = roundsFile.readAll();
      roundsFile.close();
      return Load::roundsPlayed;
  }
  </code></pre>
  
  <p>And here is the Load.h:</p>
  
  <pre><code>    #ifndef LOAD_H
       #define LOAD_H
  
      #include &lt;QtCore&gt;
  
      class Load
      {
      private:
          QString roundsPlayed; //and here
      public:
          Load();
          QString loadRoundsPlayed(); //and here
      };
  
      #endif // LOAD_H
  </code></pre>
  
  <p>And finally the place where i call the function:</p>
  
  <pre><code>    #include "mainwindow.h"
       #include "ui_mainwindow.h"
      #include "load.h"
      #include &lt;QLCDNumber&gt;
  
      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui-&gt;setupUi(this);
          MainWindow::startupLoad();
      }
  
      MainWindow::~MainWindow()
      {
          delete ui;
      }
      void MainWindow::startupLoad()
      {
          ui-&gt;roundPlayer_lcdNumber-&gt;display(Load::loadRoundsPlayed()); //right here
      }
  </code></pre>
  
  <p>When i run this i get that error. Im not sure what it means so if anyone could help i would be thankfull. Thanks.</p>