Add function keyPressEvent for class TcCounter.