#include <mainwindow.h>
Definition at line 33 of file mainwindow.h.
Public Member Functions | |
MainWindow () | |
Protected Member Functions | |
void | closeEvent (QCloseEvent *event) |
Private Slots | |
void | newFile () |
void | open () |
bool | save () |
bool | saveAs () |
void | about () |
void | documentWasModified () |
Private Member Functions | |
void | createActions () |
void | createMenus () |
void | createToolBars () |
void | createStatusBar () |
void | readSettings () |
void | writeSettings () |
bool | maybeSave () |
void | loadFile (const QString &fileName) |
bool | saveFile (const QString &fileName) |
void | setCurrentFile (const QString &fileName) |
QString | strippedName (const QString &fullFileName) |
Private Attributes | |
QTextEdit * | textEdit |
QString | curFile |
QMenu * | fileMenu |
QMenu * | editMenu |
QMenu * | helpMenu |
QToolBar * | fileToolBar |
QToolBar * | editToolBar |
QAction * | newAct |
QAction * | openAct |
QAction * | saveAct |
QAction * | saveAsAct |
QAction * | exitAct |
QAction * | cutAct |
QAction * | copyAct |
QAction * | pasteAct |
QAction * | aboutAct |
QAction * | aboutQtAct |
MainWindow::MainWindow | ( | ) |
Definition at line 28 of file mainwindow.cpp.
References createActions(), createMenus(), createStatusBar(), createToolBars(), QTextEdit::document(), documentWasModified(), readSettings(), QMainWindow::setCentralWidget(), setCurrentFile(), and textEdit.
void MainWindow::closeEvent | ( | QCloseEvent * | event | ) | [protected] |
Definition at line 46 of file mainwindow.cpp.
References maybeSave(), and writeSettings().
void MainWindow::newFile | ( | ) | [private, slot] |
Definition at line 56 of file mainwindow.cpp.
References QTextEdit::clear(), maybeSave(), setCurrentFile(), and textEdit.
Referenced by createActions().
void MainWindow::open | ( | ) | [private, slot] |
Definition at line 64 of file mainwindow.cpp.
References QFileDialog::getOpenFileName(), QString::isEmpty(), loadFile(), and maybeSave().
Referenced by createActions().
bool MainWindow::save | ( | ) | [private, slot] |
Definition at line 73 of file mainwindow.cpp.
References curFile, QString::isEmpty(), saveAs(), and saveFile().
Referenced by createActions(), and maybeSave().
bool MainWindow::saveAs | ( | ) | [private, slot] |
Definition at line 82 of file mainwindow.cpp.
References QFileDialog::getSaveFileName(), QString::isEmpty(), and saveFile().
Referenced by createActions(), and save().
void MainWindow::about | ( | ) | [private, slot] |
Definition at line 91 of file mainwindow.cpp.
References QMessageBox::about().
Referenced by createActions().
void MainWindow::documentWasModified | ( | ) | [private, slot] |
Definition at line 99 of file mainwindow.cpp.
References QTextEdit::document(), and textEdit.
Referenced by MainWindow().
void MainWindow::createActions | ( | ) | [private] |
void MainWindow::createMenus | ( | ) | [private] |
Definition at line 164 of file mainwindow.cpp.
References aboutAct, aboutQtAct, QMenu::addAction(), QMenu::addSeparator(), copyAct, cutAct, editMenu, exitAct, fileMenu, helpMenu, QMainWindow::menuBar(), newAct, openAct, pasteAct, saveAct, and saveAsAct.
Referenced by MainWindow().
void MainWindow::createToolBars | ( | ) | [private] |
Definition at line 186 of file mainwindow.cpp.
References QToolBar::addAction(), QMainWindow::addToolBar(), copyAct, cutAct, editToolBar, fileToolBar, newAct, openAct, pasteAct, and saveAct.
Referenced by MainWindow().
void MainWindow::createStatusBar | ( | ) | [private] |
Definition at line 199 of file mainwindow.cpp.
References QMainWindow::statusBar().
Referenced by MainWindow().
void MainWindow::readSettings | ( | ) | [private] |
Definition at line 204 of file mainwindow.cpp.
References QSettings::value().
Referenced by MainWindow().
void MainWindow::writeSettings | ( | ) | [private] |
Definition at line 213 of file mainwindow.cpp.
References QSettings::setValue().
Referenced by closeEvent().
bool MainWindow::maybeSave | ( | ) | [private] |
Definition at line 220 of file mainwindow.cpp.
References QTextEdit::document(), save(), textEdit, and QMessageBox::warning().
Referenced by closeEvent(), newFile(), and open().
void MainWindow::loadFile | ( | const QString & | fileName | ) | [private] |
Definition at line 236 of file mainwindow.cpp.
References QFile::open(), QTextStream::readAll(), QApplication::restoreOverrideCursor(), setCurrentFile(), QApplication::setOverrideCursor(), QMainWindow::statusBar(), textEdit, and QMessageBox::warning().
Referenced by open().
bool MainWindow::saveFile | ( | const QString & | fileName | ) | [private] |
Definition at line 256 of file mainwindow.cpp.
References QFile::open(), QApplication::restoreOverrideCursor(), setCurrentFile(), QApplication::setOverrideCursor(), QMainWindow::statusBar(), textEdit, and QMessageBox::warning().
Referenced by save(), and saveAs().
void MainWindow::setCurrentFile | ( | const QString & | fileName | ) | [private] |
Definition at line 277 of file mainwindow.cpp.
References curFile, QTextEdit::document(), QString::isEmpty(), strippedName(), and textEdit.
Referenced by loadFile(), MainWindow(), newFile(), and saveFile().
QTextEdit* MainWindow::textEdit [private] |
Definition at line 64 of file mainwindow.h.
Referenced by createActions(), documentWasModified(), loadFile(), MainWindow(), maybeSave(), newFile(), saveFile(), and setCurrentFile().
QString MainWindow::curFile [private] |
QMenu* MainWindow::fileMenu [private] |
QMenu* MainWindow::editMenu [private] |
QMenu* MainWindow::helpMenu [private] |
QToolBar* MainWindow::fileToolBar [private] |
QToolBar* MainWindow::editToolBar [private] |
QAction* MainWindow::newAct [private] |
Definition at line 72 of file mainwindow.h.
Referenced by createActions(), createMenus(), and createToolBars().
QAction* MainWindow::openAct [private] |
Definition at line 73 of file mainwindow.h.
Referenced by createActions(), createMenus(), and createToolBars().
QAction* MainWindow::saveAct [private] |
Definition at line 74 of file mainwindow.h.
Referenced by createActions(), createMenus(), and createToolBars().
QAction* MainWindow::saveAsAct [private] |
QAction* MainWindow::exitAct [private] |
QAction* MainWindow::cutAct [private] |
Definition at line 77 of file mainwindow.h.
Referenced by createActions(), createMenus(), and createToolBars().
QAction* MainWindow::copyAct [private] |
Definition at line 78 of file mainwindow.h.
Referenced by createActions(), createMenus(), and createToolBars().
QAction* MainWindow::pasteAct [private] |
Definition at line 79 of file mainwindow.h.
Referenced by createActions(), createMenus(), and createToolBars().
QAction* MainWindow::aboutAct [private] |
QAction* MainWindow::aboutQtAct [private] |