2 // keygrabber.cpp - Widget to grab a key and dismiss itself
5 // (C) 2011 Underground Software
7 // JLH = James L. Hammons <jlhamm@acm.org>
10 // --- ---------- -------------------------------------------------------------
11 // JLH 07/18/2011 Created this file
14 #include "keygrabber.h"
17 KeyGrabber::KeyGrabber(QWidget * parent/*= 0*/): QDialog(parent)
19 label = new QLabel(this);
20 QVBoxLayout * mainLayout = new QVBoxLayout;
21 mainLayout->addWidget(label);
22 setLayout(mainLayout);
23 setWindowTitle(tr("Grab"));
26 KeyGrabber::~KeyGrabber()
30 //void KeyGrabber::SetText(QString keyText)
31 void KeyGrabber::SetKeyText(int keyNum)
33 char jagButtonName[21][10] = { "Up", "Down", "Left", "Right",
34 "*", "7", "4", "1", "0", "8", "5", "2", "#", "9", "6", "3",
35 "A", "B", "C", "Option", "Pause" };
37 QString text = QString(tr("Press key for \"%1\"<br>(ESC to cancel)"))
38 .arg(QString(jagButtonName[keyNum]));
42 void KeyGrabber::keyPressEvent(QKeyEvent * e)