创建一个QMainWindow,必须有Central Widget
setCentralWidget(), 通常central widget是一个QTextEdit或者QGraphicsView.如果想让界面是MDI(multiple document interface),就用QMdiArea作为central Widget.
Menu:
QMenuBar存放QMenu. 菜单和QAction关联,每个QAction就是menu item.
QMainWindow.menuBar() 返回QMenuBar对象, QMenuBar.setMenuBar(); 如果要定制menu bar,就调用SetMenuWidget(), 对QMenuBar对象调用addMenu(String),对QMenu调用addAction(QAtion)
createPopupMenu()创建右键菜单。默认的实现是所有dock widget和tool bar中可行的操作
Toolbar:
addToolBar(String),指定Toolbar位置, Qt.ToolBarArea, QToolBar.setAllowedAreas(),QToolBar.setMovable(). 排版:addToolBarBreak() insertOoolBarBreak(),外观: setIconSize(),setToolButtonStyle()
Dock Widgets:
addDockWidget( Qt.DockWidgetArea, dockWidget)
Status Bar:
One is created the first time statusBar() is called.
Storing State:
saveState(),restoreState(). It is the position and size of the toolbars and dock widgets that are stored.
-
addDockWidget (self, Qt.DockWidgetArea, QDockWidget)
-
addDockWidget (self, Qt.DockWidgetArea, QDockWidget, Qt.Orientation)
-
addToolBar (self, Qt.ToolBarArea, QToolBar)
-
addToolBar (self, QToolBar)
-
QToolBar addToolBar (self, QString)
-
setCentralWidget (self, QWidget)
-
QMenuBar menuBar (self)
-
QWidget menuWidget (self)
-
QStatusBar statusBar (self)