[Qt-interest] QtConcurrent::run inside classes
Stefan Bisplinghoff
bisplinghoff at hia.rwth-aachen.de
Mon May 4 13:58:14 CEST 2009
Hi all!
Really got no clue, what I'm doing wrong with the QtConcurrent framework.
I extended the qtconcurrent/runfunction example (which works well) with
a class definition:
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
using namespace QtConcurrent;
class SomeClass
{
public:
SomeClass() {};
void hello(QString name)
{
qDebug() << "Hello" << name
<< "from" << QThread::currentThread();
};
void test()
{
QFuture<void> f1 = run(SomeClass::hello,
QString("Alice"));
QFuture<void> f2 = run(SomeClass::hello,
QString("Bob"));
f1.waitForFinished();
f2.waitForFinished();
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
SomeClass a = SomeClass();
a.test();
}
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----
On compile time, I get a lot of C2780 errors (X args expected, 2 args
supported, X in [1,3..7]) for the run function.
Curiously, adding additional parameter or removing the QString to/from
the hello function results in the same error messages, leaving the
current configuration out, e.g., [2..7] args expected, 1 arg supported /
[1..3,5..7] args expected, 4 args supported and so on.
Any help is appreciated!
Kind regards,
Stefan
More information about the Qt-interest-old
mailing list