VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages

exampleMenuItem.h

/******************************************************************************
** Copyright (c) 2015 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
#pragma once
//This is a menu item that will prompt the user for some text and then
//send that text in a comment interaction using the global DtExConnInterface.
{
public:
virtual ~DtExampleMenuItem() override;
//Build a menu item (via an action).
virtual QAction* createAction(makVrv::DtDe&, QWidget* parent) override;
protected:
//This is the method that is called when the user selects the action.
virtual void on_triggered() override;
protected:
};

exampleMenuItem.cxx

/******************************************************************************
** Copyright (c) 2015 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
#include <QtWidgets/QAction>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QApplication>
using namespace makVrf;
: makVrv::DtMenuItem("DtExampleMenuItem")
, myDe(de)
{
}
{
}
{
// Create a QAction that will get placed on the menu.
// The DtVrfSimulationMenuItem parent class for this action has some functionality
// to allow this item to be enabled and disabled in various circumstances.
QAction* act = new DtVrfSimulationMenuItem(myDe, parent, DtVrfSimulationMenuItem::DtAlwaysEnabled);
act->setText(makVrv::DtMenuItem::tr("Send Comment Interaction..."));
return act;
}
{
// This code is for finding the correct parent dialog for the dialog boxes.
QAction* action = dynamic_cast<QAction*>(sender());
QWidget* parent = 0;
if(action)
{
parent = action->parentWidget();
}
// Get some input from the user.
QString message = QInputDialog::getText(parent, "Send Comment Interaction", "Comment Data:");
// Use the global DtExConnInterface to initiate some action on the exercise connection.
{
DtString(message.toLocal8Bit().data()));
}
else
{
QMessageBox::information(parent, "Info", "Could not find theExConnInterface.");
}
}

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)