summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/tools/linguist/tutorial/tt3/mainwindow.cpp
blob: 97adb8d1005829c1bac1f9a34a160c8bd20a67ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/****************************************************************
**
** Implementation of MainWindow class, translation tutorial 3
**
****************************************************************/

#include "mainwindow.h"
#include "printpanel.h"

#include <tqaccel.h>
#include <tqapplication.h>
#include <tqmenubar.h>
#include <tqmessagebox.h>
#include <tqpopupmenu.h>

MainWindow::MainWindow( TQWidget *parent, const char *name )
    : TQMainWindow( parent, name )
{
    setCaption( tqtr("Troll Print 1.0") );

    PrintPanel *pp = new PrintPanel( this );
    setCentralWidget( pp );

    TQPopupMenu *file = new TQPopupMenu( this );
    file->insertItem( tqtr("E&xit"), tqApp, TQT_SLOT(quit()),
		      tqtr("Ctrl+Q", "Quit") );
    TQPopupMenu *help = new TQPopupMenu( this );
    help->insertItem( tqtr("&About"), this, TQT_SLOT(about()), Qt::Key_F1 );
    help->insertItem( tqtr("About &TQt"), this, TQT_SLOT(aboutTQt()) );

    menuBar()->insertItem( tqtr("&File"), file );
    menuBar()->insertSeparator();
    menuBar()->insertItem( tqtr("&Help"), help );
    menuBar()->setSeparator( TQMenuBar::InWindowsStyle );
}

void MainWindow::about()
{
    TQMessageBox::information( this, tqtr("About Troll Print 1.0"),
		   tqtr("Troll Print 1.0.\n\n"
		      "Copyright 1999 Macroshaft, Inc.") );
}

void MainWindow::aboutTQt()
{
    TQMessageBox::aboutTQt( this );
}