Commit 426e47f8 authored by Mike Kremer's avatar Mike Kremer
Browse files

Added some notes on how to use the OpenFlipperThread class.

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9c43a53d
......@@ -30,8 +30,6 @@
......@@ -40,6 +38,37 @@
#include <OpenFlipper/common/GlobalDefines.hh>
\class OpenFlipperThread
Instanciate this class in order to provide a thread
to a plugin. Unless you don't need a specialized
run() or cancel() function, it won't be necessary to
reimplement this class. Just connect the signals
for the thread to work properly.
The following example shows a simple example
of how to use this class from within a plugin:
OpenFlipperThread* myThread = new OpenFlipperThread("MyPluginsThread");
// Connect the appropriate signals
connect(myThread, SIGNAL(state(QString, int)), this, SIGNAL(setJobState(QString, int)));
connect(myThread, SIGNAL(finished(QString)), this, SIGNAL(finishJob(QString)));
connect(myThread, SIGNAL(function()), this, SLOT(myPluginsThreadFunction()), Qt::DirectConnection);
// Tell core about my thread
emit startJob( "MyPluginsThread", "Thread Description" , 0 , 100 , true);
// Start internal QThread
// Start actual processing of job
class OpenFlipperJob;
class DLLEXPORT OpenFlipperThread : public QThread
......@@ -58,8 +87,8 @@ class DLLEXPORT OpenFlipperThread : public QThread
/** \brief Main processing
* Connect a function to the function() signal ( DirectConnection!!! )
* Or reimplement this function
* Either reimplement this function or connect the function()
* signal.
virtual void run();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment