4.2.7. Frequently Asked Question

4.2.7.1. I have connected a signal and slot, but nothing is happening. What is missing?

Make sure you are using the @Slot() decorator for the Slot.

The Object where the Slot is located must inherit from QObject. Make sure that at some point in the inheritance tree this happens. You can add it to the particular class definition, but please make sure first any of its ancestors do not have them.

4.2.7.2. What causes the GUI to freeze?

A slot, or method in your GUI is using too much time in the main thread. You should keep to a minimum the ammount of time slots and main thread methods can use.

Qt runs all input detection and rendering instructions in the main thread. This is shared with the signal/slot mechanism. If you have a task that takes too much time to complete, you should move it to a separate thread. This tutorial includes an example how to do this.