响应事件处理

bool VCArmEventHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&aa)
{
    bool handled = false;
    
    
    switch (ea.getEventType())
        {
        case osgGA::GUIEventAdapter::FRAME:
        {
            break;
        }
        case osgGA::GUIEventAdapter::MOVE:
        {
            //handled = handleMouseMoved( ea, aa );
            break;
        }
        case  osgGA::GUIEventAdapter::KEYDOWN:
        {
            const int key = ea.getKey();
            if (ea.getKey() == 0xFF51)
            {//水平正向旋转
                emit signalVCArmForwardDirectionRotationH_1();
            }
            else if (ea.getKey() == 0xFF53)
            {
                //水平逆向旋转
                emit signalVCArmReverseDirectionRotationH_1();
            }
            else if (ea.getKey() == 0xFF52)
            {
                //竖直正向旋转
                emit signalVCArmForwardDirectionRotationV_1();
            }
            else if (ea.getKey() == 0xFF54)
            {
                //竖直逆向旋转
                emit signalVCArmReverseDirectionRotationV_1();
            }
            
            break;
        }
        default:
            break;
        }
    return handled;
}

原文地址:https://www.cnblogs.com/herd/p/11319632.html