-2

Let's say when user clicks a button an (slow) operation is performed involving database access. The problem is that the GUI becomes unresponsive if I call the operation directly.

ui->comboBox->addItems(obj->getThingsFromDatabase())

I've also tried with signals/slots, emit a request to obj and then wait his response (another signal). Anyway, the result was the same, unresponsive GUI.

What should be the approach for this issue?

ymoreau
  • 3,402
  • 1
  • 22
  • 60
nsejxT nsejxT
  • 87
  • 1
  • 4

1 Answers1

0

Best way to deal with it is to use another thread for getting things from database.
Here is really good guide how to use threads in Qt: threading basics in Qt4

tema
  • 1,115
  • 14
  • 33