Qt-interest Archive, May 2008
Can We Pass Parameters to QThread
Message 1 in thread
Hi,
Can We Pass Parameters to QThread and How?
Thanks and Regards,
Niranjan.
--
[ signature omitted ]
Message 2 in thread
> Can We Pass Parameters to QThread and How?
Hi, I am not quite sure if we both have the same understanding of the word
"parameters" but what's wrong with i.e.:
class MyThread : public QThread
{
Q_OBJECT
public:
MyThread(int aParam1, const QString & arcParam2, QObject *
apParent = NULL)
: QThread(apParent)
{
mParam1 = aParam1;
mParam2 = arcParam2;
}
protected:
virtual void run()
{
doSomethingUsingParams();
}
private:
int mParam1;
QString mParam2;
};
Regards,
Malte
--
[ signature omitted ]