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
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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 );