Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33628

Code snippet error in documentation

XMLWordPrintable

      Open the link and see the code snippet .

      http://qt-project.org/doc/qt-5.1/qtcore/qthread.html

      class Worker : public QObject
      {
          Q_OBJECT
          QThread workerThread;
      
      public slots:
          void doWork(const QString &parameter) {
              // ...
              emit resultReady(result);
          }
      
      signals:
          void resultReady(const QString &result);
      };
      
      class Controller : public QObject
      {
          Q_OBJECT
          QThread workerThread;
      public:
      
      

      The Worker class should not be having the object,
      QThread workerThread;
      if it was for a purpose, say incase controller forgot to send a workerThread object when movetoThread(), then that should be shown in the example snippet.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            ablasche Alex Blasche
            tapadar Indrajit Tapadar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes