tags:

views:

114

answers:

1

Hi,

I try to create a thread in QT, can declare, create and start it, however it doesn't fire Run function (I can see that via putting a breakpoint in that function)

VT.h:

class VT : public QThread
{

 public:
    void Run();
};

VT.cpp

void VT::Run()
{
..
}

and in main.cpp:

VT vt;
vt.Start();
// starts ok but no action

I am including other headers in VT.h, do they block? With some incomp. issue?

+4  A: 

Your Run function started with a capital R, QThread's virtual run() is lower-case. The compiler thinks your Run() is something totally unrelated to QThread.

Try renaming your function to void VT::run().

Also, it's a good idea to make your run function protected, just like in QThread.

leegent