Table of Contents
[ fromfile: mainwindows.xml id: mainwindows ]
Most QApplications manage a single QMainWindow. As Figure 10.1 shows, the QMainWindow has some features that are common to most desktop applications.
Central widget
Menu bar
Toolbars
Status bar
Dock regions
In most applications, the QMainWindow is the (grand)parent object of all QAction, QWidget, and QObject heap objects. It is common practice to extend that class for applications, as shown in Example 10.1.
Example 10.1. src/widgets/mainwindow/mymainwindow.h
[ . . . . ] class MyMainWindow : public QMainWindow { Q_OBJECT public: explicit MyMainWindow(QWidget* parent=0); void closeEvent(QCloseEvent* event); protected slots: virtual void newFile(); virtual void open(); virtual bool save(); [ . . . . ]
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |