QApplication::instance()->thread() will give you main threadid.