8 AppWindow::AppWindow(QWidget *parent):QMainWindow(parent)
10 mWorkspace=new Workspace();
11 setCentralWidget(mWorkspace);
19 void AppWindow::newFile()
24 void AppWindow::open()
29 bool AppWindow::save()
34 bool AppWindow::saveAs()
39 void AppWindow::createActions()
41 newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
42 newAct->setShortcuts(QKeySequence::New);
43 newAct->setStatusTip(tr("Create a new file"));
44 connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
46 openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
47 openAct->setShortcuts(QKeySequence::Open);
48 openAct->setStatusTip(tr("Open an existing file"));
49 connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
51 saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
52 saveAct->setShortcuts(QKeySequence::Save);
53 saveAct->setStatusTip(tr("Save the document to disk"));
54 connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
56 saveAsAct = new QAction(tr("Save &As..."), this);
57 saveAsAct->setShortcuts(QKeySequence::SaveAs);
58 saveAsAct->setStatusTip(tr("Save the document under a new name"));
59 connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
61 exitAct = new QAction(tr("E&xit"), this);
62 exitAct->setShortcuts(QKeySequence::Quit);
63 exitAct->setStatusTip(tr("Exit the application"));
64 connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
67 menuBar()->addSeparator();
71 void AppWindow::createToolBars()
73 fileToolBar = addToolBar(tr("File"));
74 fileToolBar->addAction(newAct);
75 fileToolBar->addAction(openAct);
76 fileToolBar->addAction(saveAct);
81 void AppWindow::createStatusBar()
83 statusBar()->showMessage(tr("Ready"));
86 void AppWindow::readSettings()
91 void AppWindow::writeSettings()
96 bool AppWindow::maybeSave()
103 void AppWindow::createMenus()
105 fileMenu = menuBar()->addMenu(tr("&File"));
106 fileMenu->addAction(newAct);
107 fileMenu->addAction(openAct);
108 fileMenu->addAction(saveAct);
109 fileMenu->addAction(saveAsAct);
110 fileMenu->addSeparator();
111 fileMenu->addAction(exitAct);