GUI classes in Qt can only be accessed from the main thread.
The official solution to this problem is to do your heavy work in a different thread, and not let your GUI freeze. See https://doc.qt.io/qt-5/threads-technologies.html for different ways to use threads in Qt.
WARNING: You should NOT add slots to classes derived from QThread. From the documentation (https://doc.qt.io/qt-5/qthread.html):
It is important to remember that a QThread instance lives in the old thread that instantiated it, not in the new thread that calls run(). This means that all of QThread's queued slots will execute in the old thread. Thus, a developer who wishes to invoke slots in the new thread must use the worker-object approach; new slots should not be implemented directly into a subclassed QThread.
These links are for Qt 5, but most of the concepts apply to Qt 4.8 too.