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

This example shows how to register for a VR-Link interaction (in this case the comment interaction) and can pass that information to the front-end via an event signaler.

This example is an example of a protocol dependent example.

This example will show how to:

exampleMenu.h

/******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
/******************************************************************************
** $RCSfile: exampleMenu.h,v $ $Revision: 1.2 $ $State: Exp $
******************************************************************************/
//\file exampleMenu.h
//\brief Contains declarations example menu and menu item classes
#pragma once
//New main menu. This menu will be used to hold the Remote Control Console menu item
{
public:
virtual ~DtCallbackMenu();
//Must implement in order to create Qt menu
QMenu* createMenu( makVrv::DtDe& de, QWidget* parent );
};
//This menu item will use the DtExampleEventSignaler to signal the network thread to
//send out a pdu or interaction, depending on protocol.
{
public:
//Build a menu item (via an action).
virtual QAction* createAction(makVrv::DtDe&, QWidget* parent);
protected:
//Called when the menu item is selected by the user
void on_triggered();
protected:
};

exampleMenu.cxx

/*******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file exampleMenu.cxx
//\brief Defines example menu and menu item to be used in the networkCallbackManager
//example
#include "exampleMenu.h"
#include <QtWidgets/QMenu>
#include <QtWidgets/QAction>
using namespace makVrv;
//New main menu. This menu will be used to hold the Remote Control Console menu item
: DtMenu(de, "DtCallbackMenu")
{
}
{
}
QMenu* DtCallbackMenu::createMenu( DtDe& de, QWidget* parent )
{
QMenu* menu = new QMenu(QObject::tr("Network Callback"), parent);
return menu;
}
//This menu item will use the DtExampleEventSignaler to signal the network thread to
//send out a pdu or interaction, depending on protocol.
: DtMenuItem("DtCallbackMenuItem")
, myDe(de)
{
}
{
}
//Build a menu item (via an action).
{
return new QAction(tr("Send Network Message"), parent);
}
{
DtExampleEventSignaler::instance(DtSharedSettingsManager::instance(myDe)).signal_sendPdu();
}

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)