![]() |
VR-Forces 4.0.4 Class Documentation
|
The Modify Task example demonstrates the following:
This example changes the "Move To Waypoint" dialog so that it no longer has the "Movement Method" selection box in the lower section of the dialog.
/******************************************************************************* ** Copyright (c) 2011 MAK Technologies, Inc. ** All rights reserved. *******************************************************************************/ //\file modifyTaskPlugin.cxx //This file defines the generic DT_DLL_VRF_PLUGIN_EXPORT_MACRO. Use that macro when //you want to export symbols. Also, in your CMakeLists.txt file, make sure to //define the VRFPLUGIN_EXPORTS define to tell the compiler to define the macro as an //export #include <vrfGuiCore/vrfGuiExportPlugin.h> #include <vrfGuiCoreQt/DtVrfTaskSetDialogManager.h> #include <vrfGuiCoreQt/DtTaskMoveToDialog.h> #include <vrfGuiCoreQt/DtTaskSetMenuItems.h> #include <vrvCore/DtDe.h> #include <QtGui/QGroupBox> #include <QtGui/QLabel> #include <QtGui/QLayout> //Override of task move to dialog. Will hide choice of path plan or regular movement mode class MyTaskMoveToDialog : public makVrf::DtTaskMoveToDialog { public: MyTaskMoveToDialog(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0) : makVrf::DtTaskMoveToDialog(de, parent, flags) { } protected: //Override the contents method, calling the parent method first to create the contents, then //hide the movement box virtual QWidget* contents(const std::vector<makVrv::DtSimEntry*>& data) { QWidget* canvas = makVrf::DtTaskMoveToDialog::contents(data); myMovementBox->hide(); QLabel* label = new QLabel(tr("Modified By Example"), canvas); ((QVBoxLayout*)canvas->layout())->insertWidget(2, label); return canvas; } }; //Override of creator for task move to dialog. Will create new instance //of the move to dialog class MyTaskMoveToDialogCreator : public makVrf::DtTaskMoveToDialogCreator { public: virtual makVrf::DtTaskSetDialogInterface* create(makVrv::DtDe& de, QWidget* parent) { return new MyTaskMoveToDialog(de, parent, theTaskSetCreationFlags); } }; bool initDeModule(makVrv::DtDe* de) { //The DtVrfTaskSetDialogManager is the class that holds all the creators //for task and set dialogs. Install an override creator here to create //an instance of the move to dialog makVrf::DtVrfTaskSetDialogManager& manager = makVrf::DtVrfTaskSetDialogManager::instance(*de); //And add the new creator manager.addDialogCreator(DtTaskMoveToAction, new MyTaskMoveToDialogCreator); return true; } void DtPluginInformation(DtVrfPluginInformation& info) { info.pluginName = "Modify Task"; info.pluginDescription = "This example shows how to modify an existing task dialog (Move To Waypoint...) to add your own functionality."; info.pluginVersion = "1.00"; info.pluginCreator = "MAK Technologies"; info.pluginCreatorEmail = "sales@mak.com"; info.pluginContactWebPage = "www.mak.com"; info.pluginContactMailingAddress = "68 Moulton Street - Cambridge, MA 02138"; info.pluginContactPhone = "(617) 876 8085"; }