Fix threading for Qt5.