|  | Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions |

# mainwindow.h Example File
mainwindows/recentfiles/mainwindow.h

        #ifndef MAINWINDOW_H
        #define MAINWINDOW_H

        #include <QList>
        #include <QMainWindow>

        class QAction;
        class QMenu;
        class QTextEdit;

        class MainWindow : public QMainWindow
        {
            Q_OBJECT

        public:
            MainWindow();

        private slots:
            void newFile();
            void open();
            void save();
            void saveAs();
            void openRecentFile();
            void about();

        private:
            void createActions();
            void createMenus();
            void loadFile(const QString &fileName);
            void saveFile(const QString &fileName);
            void setCurrentFile(const QString &fileName);
            void updateRecentFileActions();
            QString strippedName(const QString &fullFileName);

            QString curFile;

            QTextEdit *textEdit;
            QMenu *fileMenu;
            QMenu *recentFilesMenu;
            QMenu *helpMenu;
            QAction *newAct;
            QAction *openAct;
            QAction *saveAct;
            QAction *saveAsAct;
            QAction *closeAct;
            QAction *exitAct;
            QAction *aboutAct;
            QAction *aboutQtAct;
            QAction *separatorAct;

            enum { MaxRecentFiles = 5 };
            QAction *recentFileActs[MaxRecentFiles];
        };

        #endif