57
57
<pre> arrowPad = new ArrowPad;</pre>
58
58
<p>In the implementation of <tt>MainWindow</tt>, <tt>mainwindow.cpp</tt>, we create an instance of our <tt>ArrowPad</tt> class.</p>
59
59
<pre> exitAct = new QAction(tr("E&xit"), this);
61
61
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));</pre>
62
62
<p>We also call <tt>MainWindow::tr()</tt> twice, once for the action and once for the shortcut.</p>
63
63
<p>Note the use of <tt>tr()</tt> to support different keys in other languages. "Ctrl+Q" is a good choice for Quit in English, but a Dutch translator might want to use "Ctrl+A" (for Afsluiten) and a German translator "Strg+E" (for Beenden). When using <tt>tr()</tt> for <b>Ctrl</b> key accelerators, the two argument form should be used with the second argument describing the function that the accelerator performs.</p>