mainwindow.cpp

来自「qt-x11-free-3.0.3.tar.gz minigui图形界面工具」· C++ 代码 · 共 48 行

CPP
48
字号
/******************************************************************** Implementation of MainWindow class, translation tutorial 3******************************************************************/#include "mainwindow.h"#include "printpanel.h"#include <qaccel.h>#include <qapplication.h>#include <qmenubar.h>#include <qmessagebox.h>#include <qpopupmenu.h>MainWindow::MainWindow( QWidget *parent, const char *name )    : QMainWindow( parent, name ){    setCaption( tr( "Troll Print 1.0" ) );    PrintPanel *pp = new PrintPanel( this );    setCentralWidget( pp );    QPopupMenu *file = new QPopupMenu( this );    file->insertItem( tr( "E&xit" ), qApp, SLOT(quit()),		      QAccel::stringToKey( tr("Ctrl+Q", "Quit") ) );    QPopupMenu *help = new QPopupMenu( this );    help->insertItem( tr( "&About..." ), this, SLOT(about()), Key_F1 );    help->insertItem( tr( "About &Qt..." ), this, SLOT(aboutQt()) );    menuBar()->insertItem( tr( "&File" ), file );    menuBar()->insertSeparator();    menuBar()->insertItem( tr( "&Help" ), help );    menuBar()->setSeparator( QMenuBar::InWindowsStyle );}void MainWindow::about(){    QMessageBox::information( this, tr( "About Troll Print 1.0" ),		   tr( "Troll Print 1.0.\n\n"		      "Copyright 1999 Macroshaft, Inc." ) );}void MainWindow::aboutQt(){    QMessageBox::aboutQt( this );}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?