I have some simple code to read a web page. You have seen the code before, it is very simple:
Qt Code:
  1. QNetworkRequest request;
  2. QUrl hostUrl;
  3. hostUrl.setUrl("http://qt.nokia.com");
  4. request.setUrl(hostUrl);
  5. QNetworkReply* reply = networkAccessManager->get(request);
To copy to clipboard, switch view to plain text mode 
Next, I connect more connections than seems reasonable. My question is, how should I do this in a GUI? My initial solution was to run this code in a slot that was called from a menu item. Of course, I have no response unless i start an event loop:
Qt Code:
  1. loop.exec();
To copy to clipboard, switch view to plain text mode 
I had expected that this would use the GUI's event loop (a GUI always has an event loop, right?) You know, started this way
Qt Code:
  1. QApplication a(argc, argv);
  2. MainWindow w;
  3. w.show();
  4. return a.exec();
To copy to clipboard, switch view to plain text mode 
That said, I find it disturbing that I started an event loop in a handler for a menu command.