title: QTimer to execute method every second
body: <p>I'm learning Qt and I was reading about Threads, Events and QObjects from Qt wiki, and followed the wiki recommendations on how to handle some work in a while condition but its not working for my specific case. Here's a simple example of what I'm currently trying to achieve.</p>
  
  <pre><code>class FooEvents : public FooWrapper {
  
      public virtual serverTime(..) { std::cout &lt;&lt; "Server time event\n"; }
      public virtual connected(..) { std::cout &lt;&lt; "Connected event\n"; }
  }
  
  class Foo : public QObject {
  
  private:
  
      FooAPI *client;
  
  public:
  
  
      Foo(FooEvents *ev, QObject *parent = 0) : client(new FooApi(ev)) { .. }
  
  private slots:
      void processMessages() {
  
          if (state is IDLE)              
  
              reqFooAPiServerTime();
  
          select(client-&gt;fd()+1, ...);
  
          if (socket is ready for read)
  
              client.onReceive();
  
      }
  public:
      void connect(...) {
  
          if (connection) {
  
              QObject::connect(&amp;timer, SIGNAL(timeout()), this, SLOT(processMessages()));
              timer.start(1000);  // I don't get the output from FooEvents
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>This is a very simple but I think it illustrates my case. Why is this not working and what other alternatives to I have to handle this case? Thanks.s</p>
  
  <p>Edit: The processMessages is being called every second but I don't get any output from the events</p>