Line by Line Walkthrough
In arrowpad.h we define the ArrowPad subclass which is a subclass of QWidget. In the screenshot above, the central widget with the four buttons is an ArrowPad.
 class ArrowPad : public QWidget
 {
     Q_OBJECT
When lupdate is run it not only extracts the source texts but it also groups them into contexts. A context is the name of the class in which the source text appears. Thus, in this example, "ArrowPad" is a context: it is the context of the texts in the ArrowPad class. The Q_OBJECT macro defines tr(x) in ArrowPad like this:
 qApp->translate("ArrowPad", x)
Knowing which class each source text appears in enables Qt Linguist to group texts that are logically related together, e.g. all the text in a dialog will have the context of the dialog's class name and will be shown together. This provides useful information for the translator since the context in which text appears may influence how it should be translated. For some translations keyboard accelerators may need to be changed and having all the source texts in a particular context (class) grouped together makes it easier for the translator to perform any accelerator changes without introducing conflicts.
In arrowpad.cpp we implement the ArrowPad class.