1 | /****************************************************************
|
---|
2 | **
|
---|
3 | ** Implementation of MainWindow class, translation tutorial 3
|
---|
4 | **
|
---|
5 | ****************************************************************/
|
---|
6 |
|
---|
7 | #include "mainwindow.h"
|
---|
8 | #include "printpanel.h"
|
---|
9 |
|
---|
10 | #include <qaccel.h>
|
---|
11 | #include <qapplication.h>
|
---|
12 | #include <qmenubar.h>
|
---|
13 | #include <qmessagebox.h>
|
---|
14 | #include <qpopupmenu.h>
|
---|
15 |
|
---|
16 | MainWindow::MainWindow( QWidget *parent, const char *name )
|
---|
17 | : QMainWindow( parent, name )
|
---|
18 | {
|
---|
19 | setCaption( tr("Troll Print 1.0") );
|
---|
20 |
|
---|
21 | PrintPanel *pp = new PrintPanel( this );
|
---|
22 | setCentralWidget( pp );
|
---|
23 |
|
---|
24 | QPopupMenu *file = new QPopupMenu( this );
|
---|
25 | file->insertItem( tr("E&xit"), qApp, SLOT(quit()),
|
---|
26 | tr("Ctrl+Q", "Quit") );
|
---|
27 | QPopupMenu *help = new QPopupMenu( this );
|
---|
28 | help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
|
---|
29 | help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
|
---|
30 |
|
---|
31 | menuBar()->insertItem( tr("&File"), file );
|
---|
32 | menuBar()->insertSeparator();
|
---|
33 | menuBar()->insertItem( tr("&Help"), help );
|
---|
34 | menuBar()->setSeparator( QMenuBar::InWindowsStyle );
|
---|
35 | }
|
---|
36 |
|
---|
37 | void MainWindow::about()
|
---|
38 | {
|
---|
39 | QMessageBox::information( this, tr("About Troll Print 1.0"),
|
---|
40 | tr("Troll Print 1.0.\n\n"
|
---|
41 | "Copyright 1999 Macroshaft, Inc.") );
|
---|
42 | }
|
---|
43 |
|
---|
44 | void MainWindow::aboutQt()
|
---|
45 | {
|
---|
46 | QMessageBox::aboutQt( this );
|
---|
47 | }
|
---|