check this out
Qt Code:
  1. QPushButton * button = QPushButton("Press Me Long", this);
  2. QTimer * timer = new QTimer(this); //0 ms timer, the fastest possible QTimer
  3. connect(timer, SIGNAL(timeout()), this, SIGNAL(MySignal()); //Note: signal connected to signal
  4. connect(button, SIGNAL(pressed()), timer, SLOT(start()));
  5. connect(button, SIGNAL(released()), timer, SLOT(stop()));
To copy to clipboard, switch view to plain text mode