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