Skip to content
Snippets Groups Projects
Commit 10ff385c authored by Paul Tvete's avatar Paul Tvete
Browse files

Replace QAccel with QShortcut

QShortcut is more powerful and easier to use.
parent 0acaafd8
No related branches found
No related tags found
No related merge requests found
......@@ -65,9 +65,10 @@ GameBoard::GameBoard(QWidget *parent)
QLabel *hitsL = new QLabel( "HITS", this );
QLabel *shotsLeftL = new QLabel( "SHOTS LEFT", this );
QAccel *accel = new QAccel( this );
accel->connectItem( accel->insertItem( Qt::Key_Space), this, SLOT(fire()) );
accel->connectItem( accel->insertItem( Qt::Key_Q), qApp, SLOT(quit()) );
QShortcut *fireShortcut = new QShortcut(Qt::Key_Space, this);
connect(fireShortcut, SIGNAL(activated()), this, SLOT(fire()));
QShortcut *quitShortcut = new QShortcut(Qt::Key_Q, this);
connect(quitShortcut, SIGNAL(activated()), qApp, SLOT(quit()));
quit->setGeometry( 10, 10, 75, 30 );
angle->setGeometry( 10, quit->y() + quit->height() + 10, 75, 130 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment