title: QVector with Qthreads
body: <p>Hello I'm trying to build a <code>QVector</code> of <code>QThread</code> objects but when I try to build I get this error <code>'QObject::QObject' : cannot access private member declared in class 'QObject'</code>. Can someone tell me why I am getting this error and how to over come it or point me in the direction of answer. Thank you for you time.</p>
  
  <p>MAIN.CPP</p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  
  #include "thread.h"
  #include &lt;QDebug&gt;
  #include &lt;QThread&gt;
  
  main(int argc, char *argv[])
  {
      QCoreApplication a(argc, argv);
  
      unsigned long long startingNumberAnswer = 0;
      unsigned long long totalIterationsAnswer = 0;
      int numberOfThreads = 10;
  
  
      QVector&lt;Thread&gt; threads(numberOfThreads);
  
      for(int l = 0; l &lt; threads.size(); l++ ){
          threads[l].setPriority(QThread::TimeCriticalPriority);
      }
  
  
      for(int i = 1; i&lt; 2000000; i+=numberOfThreads){
          qDebug() &lt;&lt; "Longest iteration Number =  " &lt;&lt; startingNumberAnswer;
          qDebug() &lt;&lt; "Number of iterations for " &lt;&lt; startingNumberAnswer &lt;&lt; " is " &lt;&lt; totalIterationsAnswer;
          qDebug() &lt;&lt; "Running # " &lt;&lt; i;
  
  
          system("CLS");
  
      }
  
  
  
      qDebug() &lt;&lt; "Longest iteration Number =  " &lt;&lt; startingNumberAnswer;
      qDebug() &lt;&lt; "Number of iterations for " &lt;&lt; startingNumberAnswer &lt;&lt; " is " &lt;&lt; totalIterationsAnswer;
  
  
  
      return a.exec();
  }
  </code></pre>
  
  <p>THREAD.H</p>
  
  <pre><code>#ifndef THREAD_H
  #define THREAD_H
  
  #include &lt;QObject&gt;
  #include &lt;QThread&gt;
  
  class Thread :  public QThread
  {
      Q_OBJECT
  public:
      explicit Thread();
  
      unsigned long long getloops();
      unsigned long long getnumber();
  signals:
  
  public slots:
      void run(unsigned long long value);
  private:
      unsigned long long largestNumber;
      unsigned long long loops;
      unsigned long long number;
  
  
  };
  
  #endif // THREAD_H
  </code></pre>
  
  <p>THREAD.CPP</p>
  
  <pre><code>#include "thread.h"
  
  Thread::Thread()
  {
  }
  
  void Thread::run(unsigned long long value)
  {
     unsigned long long n = value;
     unsigned long long counter = 0;
  
     while ( n &gt; 1){
  
         if(n%2 == 0){
            n = n/2;
         } else {
            n = (3*n) + 1;
         }
  
         counter++;
     }
  
      loops = counter;
      number = value;
  
  }
  
  unsigned long long Thread::getloops(){
      return loops;
  }
  
  unsigned long long Thread::getnumber(){
      return number;
  }
  </code></pre>