For every created button do :
Qt Code:
  1. QPushButton *b1 = new QPushButton( "A", this );
  2. connect( b1, SIGNAL(clicked()), sm, SLOT(map()) );
  3. connect( b1,SIGNAL(released()),&m_timer ,SLOT(start()));
To copy to clipboard, switch view to plain text mode 
where m_timer is a QTimer hiding the keyboard after 50 seconds.