I’m starting with QT4, I’m wondering where to put my application code.
Here?
void MainWindow::changeEvent(QEvent *e) {...}
Or here? (where exactly?)
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
If I want my app not only react to user events, but to execute regularly on a loop, where do I put the loop?
Unless you loop within a non-gui thread, you will block the GUI by looping (in the implicit main gui thread). Here’s a couple of different approaches:
There are other different approaches, such as using processEvents() but I’d personally recommend the threads approach.