3.1 Creation and Initialization of Qt Objects
3.2 Creation and Initialization of HOOPS/Qt Objects
3.3 Creation and Initialization of HOOPS/MVO Objects
3.4 Launching the Qt Event Loop
Developers should start by compiling, linking and running the basic qt_simple application as the starting point for their application. This is just a skeleton application the readable source code to which is located in the demo/qt/qt_simple directory of your HOOPS installation. This applicaiton is the one you should use if you intend on completing the tutorials in this section. There are a number of other more sophisticated Qt applications included in the Qt directory which you can use as a source of reference as you add functionality to your applciation.
Qt
Only one QApplication & at least QMainWindow (or derived class)
HOOPS/Qt
At least one MyHQWidget (derived from HQWidget)
HOOPS/MVO
HBaseModel, HBaseView, an Operator class derived from HBaseOperator. Applications that want to implement selection of Geometry will also need a HSelectionSet object.
HQApplication
One HQApplication object should be created using the constructor that accepts a pointer to a Qt QApplication object. The HOOPS/Qt Reference Application performs this in the function main ( ). (Go there).
The HQApplication object should create any Qt GUI object's to be parented off of it during its initialization. The HOOPS/Qt Reference Application performs this when a HQApplication object is being initialized by calling its private method HQApplication::load (const char * filename)
MyHQWidget
As many MyHQWidgets can be created as needed to implement the GUI's design. These are more than likely going to be created by a constructor of a top level Qt Widget like QMainWindow or QDialog. The HOOPS/Qt Reference Application performs this when a HQApplication object is initialized by calling its private method
HQApplication::load (const char * filename)
HQDeleter
One global pointer must be declared and initialized in the application code block. The HOOPS/Qt Reference Application performs the global declaration in the file main.cpp (Go there) and the initialization in the body of the function main ( ). (Go there.)
HDB
One global pointer to a HOOPS/MVO HDB object must be declared and initialized in the application code block. the HOOPS/Qt Reference Application performs the global declaration in the file main.cpp (Go there) and the initialization in the body of the function main (). (Go there.)
HBaseModel
Multiple HBaseModel objects can be created as needed. The HOOPS/Qt Reference Application creates one for every MyHQWidget object, i.e., there is a one-to-one mapping of HBaseModel to MyHQWidget objects.
The creation of the HBaseModel occurs in the MyHQWidget's constructor. (Go there.)
HBaseView
Multiple HBaseView objects can be created as needed. The HOOPS/Qt Reference Application creates one for every MyHQWidget object, i.e., there is a one to one mapping of HBaseView to MyHQWidget objects. It is also possible to have multiple HBaseViews associated with one HBaseModel (i.e., multiple views of the same model) and vice versa (multiple models in the same view.)
The HBaseView needs a valid window id and colormap passed to its constructor on object creation; information used to connect a HOOPS/3dGS output driver instance to a Qt QWidget. This requires that the QtWidget, to which the HBaseView will be attached, must already exist prior to creating the HBaseView object.
The HOOPS/Qt Reference Application creates one HBaseView object per MyHQWidget instance in the virtual methodMyHQWidget's::Init( ). This method is called by the base class HQWidget in the method HQWidget::paintEvent () the first time it is called ensuring that the widget is alive and thus the Window ID is valid and the HBaseView object can be created.
HBaseView's Current Operator
The HBaseView class has a member HBaseView::current_operator that is a pointer to an HBaseOperator object. A default operator must be created and used to initialize the HBaseView's current operator member. The HOOPS/Qt Reference Application does this in the method MyHQWidget's::Init( ).
HSelectionSet
Multiple HSelectionSet object can be created as needed. The HOOPS/Qt Reference Application creates one for every MyHQWidget object, i.e., there is a one to one mapping of HSelectionSet to MyHQWidget objects. The creation of the HSelectionSet occurs in the method MyHQWidget's::Init( ).