Monday, October 13, 2008

The MainWindow Class

Features of the MainWindow Class:

This class inherits from Qt's QMainWindow, so please see Qt's documentation as well.
  • Loads plug-ins (tools) by looking for and calling the "loadTCTools" function in a dynamic library that has been loaded.
  • Contains a hash table of tools with the tool name as the key. This is used by one tool to find another tool or to check whether or not the tools has been loaded.
  • Connects to each signal in a new GraphicsScene. Therefore, whenever any GraphicsScene sends a signal, MainWindow will relay that signal. This is so that a tool does not need to connect to every GraphicScene. Connecting to MainWindow is sufficient.
  • Provides several public menus, such as the file menu, edit menu, etc, so that tools (e.g. copy/paste tool) can add to them.
  • Provides two public menus: contextScreenMenu and contextItemsMenu, which are the context menus (right-click) that pop-up when nothing is selected (contextScreenMenu) or when items are selected (contextItemsMenu). Tools can add or remove actions to these menus in order to make options available in the context menu.  Standard practice is to connect to the itemsSelected signal and set actions to the context menu there. Tools should use addSeparator()  if they wish to make the their set of actions appear separately.
  • Provides two toolBars called firstToolBar and secondToolBar. The firstToolBar contains options such as save, open, new, close, etc. and the second does not contain anything by default. It is meant to be used by tools (e.g. plot window). However, tools may also have their own tool bars (most tools do this) and can add new toolbars to the main window (see Qt's QMainWindow documention).

No comments: