The Unit Status example demonstrates the following:
- How to build a plugin module for the VR-Forces 3D Gui
- How to add a new panel to the main window
- How to work with map area selection
- How to draw an ellipse around the currently selected entity
The Unit Status example demonstrates how to add a new panel to the application and to display information in that panel about an item that is selected on the terrain map.
The example supplies a .ui file that shows how to create a dialog box using Qt Designer and how that .ui file translates itself into a .cpp and .h file that can be subclassed and extended for use in the VR-Forces GUI.
Using the Qt connection call, the panel connects to functions that send out updates when an entity is updated. This shows how user interface objects can have their states change when some aspect of an entity changes.
Usage
Since this example is loaded as a plugin Select Settings, Plugins... and on the Plugins Editor page, use the combo box at the top of the page to select the plug-in. Then enable the Load Plugin checkbox and re-start VR-Forces.
-
Start vrfGui.
-
Start vrfSim.
-
Create a new scenario.
-
Create a tank.
-
Click on tank to select it.
The 'Unit Status' panel will display information about the currently selected entity.
Classes
| DtUnitStatus | The toolbar widget that displays information about the currently selected unit. |
| DtUnitStatusLogic | The logic for setting the information into the widget. |
Plugin Entry Points
#include <vrvCore/DtVrvApplication.h>
#include <vrvCoreQt/DtQtPageAssembler.h>
#include <vrvUtil/DtDeInitializer.h>
using namespace makVrf;
{
makVrv::DtQtPageAssembler& qtPageAssembler = makVrv::DtQtPageAssembler::instance(*de);
makVrv::DtVrvApplication* igApp = makVrv::DtVrvApplication::findFromDe(*de);
if(igApp)
{
if (!igApp->masterModePageConfiguration().findPageCollectionTitle(
"DtUnitStatusPanel"))
{
igApp->masterModePageConfiguration().addPageCollection("DtUnitStatusPanel",
makVrv::DtUnicode::fromAscii("Unit Status"), makVrv::DtPageConfiguration::DockLeft, true, "DtUnitStatus");
igApp->masterModePageConfiguration().addPagePath(
makVrv::DtPagePath::collection("DtUnitStatusPanel").page("DtUnitStatus"));
}
makVrv::DtMenuPath::mainMenu(
DtViewMenuId).item(
"DtUnitStatusPanel"),
makVrv::DtPageConfiguration::PageCollectionState* state = igApp->masterModePageConfiguration().findPageCollectionState("DtUnitStatusPanel");
state->myDockedGeometry.myTop = 1000;
}
return true;
}
{
}