예제 #1
0
Event<eq::PointerEvent>::Event(const QEvent* from)
    : type(_getType(from))
{
#ifndef QT_NO_WHEELEVENT
    if (type == EVENT_WINDOW_POINTER_WHEEL)
    {
        const QWheelEvent* qevent = static_cast<const QWheelEvent*>(from);
        PointerEvent event;
        switch (qevent->orientation())
        {
        case Qt::Horizontal:
            event.xAxis = qevent->delta() > 0 ? 1 : -1;
            break;
        case Qt::Vertical:
            event.yAxis = qevent->delta() > 0 ? 1 : -1;
            break;
        }
        event.buttons = _getButtons(qevent->buttons());
        event.button = PTR_BUTTON_NONE;
    }
    else
#endif
    {
        const QMouseEvent* qevent = static_cast<const QMouseEvent*>(from);
        event.x = qevent->x();
        event.y = qevent->y();
        event.buttons = _getButtons(qevent->buttons());
        event.button = _getButton(qevent->button());
    }
}
예제 #2
0
void GLWidget::mouseMoveEvent( QMouseEvent* qevent )
{
    if( !_eventHandler )
        return;
    WindowEvent* windowEvent = new WindowEvent;
    windowEvent->eq::Event::type = Event::WINDOW_POINTER_MOTION;
    windowEvent->pointerMotion.x = qevent->x();
    windowEvent->pointerMotion.y = qevent->y();
    windowEvent->pointerMotion.buttons = _getButtons( qevent->buttons( ));
    windowEvent->pointerMotion.button  = _getButton( qevent->button( ));
    QApplication::postEvent( _eventHandler, windowEvent );
}
예제 #3
0
void GLWidget::mouseReleaseEvent( QMouseEvent* qevent )
{
    if( !_eventHandler )
        return;
    WindowEvent* windowEvent = new WindowEvent;
    windowEvent->eq::Event::type = Event::WINDOW_POINTER_BUTTON_RELEASE;
    windowEvent->pointerButtonRelease.x = qevent->x();
    windowEvent->pointerButtonRelease.y = qevent->y();
    windowEvent->pointerButtonRelease.buttons = _getButtons( qevent->buttons());
    windowEvent->pointerButtonRelease.button  = _getButton( qevent->button( ));
    QApplication::postEvent( _eventHandler, windowEvent );
}
예제 #4
0
void UserInterface::simulateClick(const UIButtonType& type)
{
    ImageButton& button = _getButton(type);
    button.select(true);
}
예제 #5
0
bool UserInterface::getUIButtonSelectState(const UIButtonType& type)
{
    ImageButton& button = _getButton(type);
    return button.isSelected();
}
예제 #6
0
void UserInterface::toggleUIButtonState(const UIButtonType& type)
{
    ImageButton& button = _getButton(type);
    button.setSelected(!button.isSelected());
}
예제 #7
0
void UserInterface::setUIButtonSelectState(const UIButtonType& type, bool state)
{
    ImageButton& button = _getButton(type);
    button.setSelected(state);
}