Replace twisted thread with QThread.

This fix the bug that prevents pastebin to work.
Closes #5949.