当前位置: 首页>>代码示例>>C++>>正文


C++ QEvent类代码示例

本文整理汇总了C++中QEvent的典型用法代码示例。如果您正苦于以下问题:C++ QEvent类的具体用法?C++ QEvent怎么用?C++ QEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: trace1

void 
ObjectEventBroker::event_filter(const RPP::QObject<QObject> object,
				const QEvent &event,
				RPP::Symbol method) const
{
  trace1("event_filter, tp = %d", event.type());
  switch (event.type())
    {
    case QEvent::Timer:
      {
	const QTimerEvent &ev_timer = static_cast<const QTimerEvent &>(event);
	object.call("emit", method, RPP::Fixnum(ev_timer.timerId()));
	return;
      }
    case QEvent::ChildAdded:
    case QEvent::ChildRemoved:
    case QEvent::ChildPolished:
      {
	const QChildEvent &ev_child = static_cast<const QChildEvent &>(event);
	object.call("emit", method, RPP::QObject<QObject>(ev_child.child()));
	return;
      }
    case QEvent::DynamicPropertyChange:
      {
	const QDynamicPropertyChangeEvent &ev_dpch 
	  = static_cast<const QDynamicPropertyChangeEvent &>(event);
	object.call("emit", method, qByteArray2v(ev_dpch.propertyName()));
	return;
      }
    default:
	break;
    }
  rb_raise(rb_eNotImpError, "events of type %s cannot be brokered yet", method.to_s());
}
开发者ID:EugeneBrazwick,项目名称:Midibox,代码行数:34,代码来源:eventsignalbroker.moc.cpp

示例2: isAccepted

bool QEventProto::isAccepted() const
{
  QEvent *item = qscriptvalue_cast<QEvent*>(thisObject());
  if (item)
    return item->isAccepted();
  return false;
}
开发者ID:xtuple,项目名称:qt-client,代码行数:7,代码来源:qeventproto.cpp

示例3: spontaneous

bool QEventProto::spontaneous() const
{
  QEvent *item = qscriptvalue_cast<QEvent*>(thisObject());
  if (item)
    return item->spontaneous();
  return false;
}
开发者ID:xtuple,项目名称:qt-client,代码行数:7,代码来源:qeventproto.cpp

示例4: switch

SES_FSM::State SES_FSM::processEventFromChild(SEE_Base* event) noexcept
{
    switch (event->getType())
    {
        case SEE_Base::AbortCommand:
        case SEE_Base::StartSelect:
            event->setAccepted(true);
            return State_Select;
        case SEE_Base::StartMove:
            event->setAccepted(true);
            return State_Move;
        case SEE_Base::StartDrawText:
            event->setAccepted(true);
            return State_DrawText;
        case SEE_Base::StartDrawRect:
            event->setAccepted(true);
            return State_DrawRect;
        case SEE_Base::StartDrawPolygon:
            event->setAccepted(true);
            return State_DrawPolygon;
        case SEE_Base::StartDrawCircle:
            event->setAccepted(true);
            return State_DrawCircle;
        case SEE_Base::StartDrawEllipse:
            event->setAccepted(true);
            return State_DrawEllipse;
        case SEE_Base::StartDrawWire:
            event->setAccepted(true);
            return State_DrawWire;
        case SEE_Base::StartAddNetLabel:
            event->setAccepted(true);
            return State_AddNetLabel;
        case SEE_Base::StartAddComponent:
            event->setAccepted(true);
            return State_AddComponent;
        case SEE_Base::SwitchToSchematicPage:
            event->setAccepted(true);
            return mCurrentState;
        case SEE_Base::GraphicsViewEvent:
        {
            QEvent* e = SEE_RedirectedQEvent::getQEventFromSEE(event);
            Q_ASSERT(e); if (!e) return mCurrentState;
            if ((e->type() == QEvent::GraphicsSceneMousePress) ||
                (e->type() == QEvent::GraphicsSceneMouseDoubleClick))
            {
                QGraphicsSceneMouseEvent* e2 = dynamic_cast<QGraphicsSceneMouseEvent*>(e);
                Q_ASSERT(e2); if (!e2) return mCurrentState;
                if (e2->buttons() == Qt::RightButton)
                    return (mPreviousState != State_NoState) ? mPreviousState : State_Select;
                else
                    return mCurrentState;
            }
        }
        default:
            return mCurrentState;
    }
}
开发者ID:0xB767B,项目名称:LibrePCB,代码行数:57,代码来源:ses_fsm.cpp

示例5: eventTest

//![0]
    bool eventTest(QEvent *event)
    {
        if (event->type() == QEvent::Wrapped) {
            QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event();
            if (wrappedEvent->type() == QEvent::KeyPress) {
                QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
                // Do your event test
            }       
        }
        return false;
    }
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:12,代码来源:eventtest.cpp

示例6: polymorphichandler_QEvent

static void* polymorphichandler_QEvent(const void *ptr, const char **class_name)
{
    Q_ASSERT(ptr != 0);
    QEvent *object = (QEvent *)ptr;
    if (object->type() == QEvent::ChildAdded || object->type() == QEvent::ChildPolished || object->type() == QEvent::ChildRemoved) {
        *class_name = "QChildEvent";
        return (QChildEvent*)object;
    }
    if (object->type() == QEvent::DynamicPropertyChange) {
        *class_name = "QDynamicPropertyChangeEvent";
        return (QDynamicPropertyChangeEvent*)object;
    }
    if (object->type() == QEvent::None) {
        *class_name = "QEvent";
        return (QEvent*)object;
    }
    if (object->type() == QEvent::StateMachineSignal) {
        *class_name = "QStateMachine_SignalEvent";
        return (QStateMachine::SignalEvent*)object;
    }
    if (object->type() == QEvent::StateMachineWrapped) {
        *class_name = "QStateMachine_WrappedEvent";
        return (QStateMachine::WrappedEvent*)object;
    }
    if (object->type() == QEvent::Timer) {
        *class_name = "QTimerEvent";
        return (QTimerEvent*)object;
    }
    return NULL;
}
开发者ID:MarekAG,项目名称:screencloud,代码行数:30,代码来源:com_trolltech_qt_core_init.cpp

示例7: tr

void EWAUserActionsEditorDialog::inserActionIntoModel( int iPos, const EWAUserAction *pAction, int iPageNum, int iActInPageNum )
{
    if( !m_pModel || !pAction )
    {
        return;
    }
    
    QString strActDelay = tr( "%1 sec" ).arg( 0.001*pAction->getTime() );
    QPixmap imgType;
    QString strActValue = pAction->getActionValue();
    
    QEvent *pActEvent = pAction->getEvent();
    
    switch( pActEvent->type()  )
    {
        case QEvent::KeyPress:
        {
            imgType = m_pixKeyDown;
            break;
        }
        case QEvent::KeyRelease:
        {
            imgType = m_pixKeyUp;
            break;
        }
        case QEvent::MouseButtonPress:
        {
            imgType = m_pixMouseDown;
            break;
        }
        case QEvent::MouseButtonRelease:
        {
            imgType = m_pixMouseUp;
            break;
        }
    default:
        {
            return;
        }
    }
    
    m_pModel->setData( m_pModel->index( iPos, 0 ), imgType, Qt::DecorationRole );
    
    m_pModel->setData( m_pModel->index( iPos, 0 ), iPageNum, PTR2PAGE_ROLE );
    m_pModel->setData( m_pModel->index( iPos, 0 ), iActInPageNum, PTR2GEST_ROLE );
    
    m_pModel->setData( m_pModel->index( iPos, 0 ), strActValue );
    m_pModel->setData( m_pModel->index( iPos, 1 ), strActDelay );
}
开发者ID:sendevent,项目名称:ewa,代码行数:49,代码来源:ewa_useractionseditordlg.cpp

示例8: _to_self

dmz::V8Value
dmz::JsModuleUiV8QtBasic::_event_type (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QEvent *event = self->_to_qevent (Args.This ());
      if (event) { result = v8::Number::New (event->type ()); }
   }

   return scope.Close (result);
}
开发者ID:ben-sangster,项目名称:js,代码行数:15,代码来源:dmzJsModuleUiV8QtBasicEvent.cpp

示例9: qDebug

bool ExpectedEventList::eventFilter(QObject *, QEvent *received)
{
    if (debug > 1)
        qDebug() << received;
    if (eventList.isEmpty())
        return false;

    bool eat = false;
    QEvent *expected = eventList.first();
    if (expected->type() == received->type()) {
        eventList.removeFirst();
        switch (received->type()) {
            case QEvent::MouseButtonPress:
            case QEvent::MouseButtonRelease:
            case QEvent::MouseMove:
            case QEvent::MouseButtonDblClick:
            case QEvent::NonClientAreaMouseButtonPress:
            case QEvent::NonClientAreaMouseButtonRelease:
            case QEvent::NonClientAreaMouseButtonDblClick:
            case QEvent::NonClientAreaMouseMove: {
                compareMouseEvents(received, expected);
                eat = true;
                break;
            }
            case QEvent::KeyPress:
            case QEvent::KeyRelease: {
                compareKeyEvents(received, expected);
                eat = true;
                break;
            }
            case QEvent::Resize: {
                break;
            }
            case QEvent::WindowActivate: {
                break;
            }
            case QEvent::WindowDeactivate: {
                break;
            }
            default:
                break;
        }
        if (eventList.isEmpty())
            QAbstractEventDispatcher::instance()->interrupt();
    }

    return eat;
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:48,代码来源:expectedeventlist.cpp

示例10: Py_INCREF

static PyObject *meth_QEvent_ignore(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QEvent *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QEvent, &sipCpp))
        {
            sipCpp->ignore();

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QEvent, sipName_ignore, doc_QEvent_ignore);

    return NULL;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:21,代码来源:sipQtCoreQEvent.cpp

示例11: polymorphichandler_Lqt_core_QEvent_2

static bool polymorphichandler_Lqt_core_QEvent_2(const void *ptr, char **class_name, char **package)
{
    Q_ASSERT(ptr != 0);
    QEvent *object = (QEvent *)ptr;
    if (object->type() == QEvent::ChildAdded || object->type() == QEvent::ChildPolished || object->type() == QEvent::ChildRemoved) {
        *class_name = "QChildEvent";
        *package    = "qt/core/";
        return true;
    }
    if (object->type() == QEvent::DynamicPropertyChange) {
        *class_name = "QDynamicPropertyChangeEvent";
        *package    = "qt/core/";
        return true;
    }
    if (object->type() == QEvent::None) {
        *class_name = "QEvent";
        *package    = "qt/core/";
        return true;
    }
    if (object->type() == QEvent::Timer) {
        *class_name = "QTimerEvent";
        *package    = "qt/core/";
        return true;
    }
    return false;
}
开发者ID:dreamsxin,项目名称:nawia,代码行数:26,代码来源:metainfo.cpp

示例12: switch

void 
WidgetEventBroker::event_filter(const RPP::QObject<QObject> object,
				   const QEvent &event,
				   RPP::Symbol method) const
{
  switch (event.type())
    {
    case QEvent::Resize:
      {
	const QResizeEvent &ev_resize = static_cast<const QResizeEvent &>(event);
	object.call("emit", method, RPP::QSize(ev_resize.size()));
	return;
      }
    case QEvent::Show:
	object.call("emit", method);
	return;
    default:
	break;
    }
  inherited::event_filter(object, event, method);
} // event_filter
开发者ID:EugeneBrazwick,项目名称:Midibox,代码行数:21,代码来源:guieventsignalbroker.moc.cpp

示例13: setAccepted

void QEventProto::setAccepted(bool accepted)
{
  QEvent *item = qscriptvalue_cast<QEvent*>(thisObject());
  if (item)
    item->setAccepted(accepted);
}
开发者ID:xtuple,项目名称:qt-client,代码行数:6,代码来源:qeventproto.cpp

示例14: Q_ASSERT

SES_Base::ProcRetVal SES_DrawWire::processPositioningSceneEvent(
    SEE_Base* event) noexcept {
  QEvent* qevent = SEE_RedirectedQEvent::getQEventFromSEE(event);
  Q_ASSERT(qevent);
  if (!qevent) return PassToParentState;
  Schematic* schematic = mEditor.getActiveSchematic();
  Q_ASSERT(schematic);
  if (!schematic) return PassToParentState;

  switch (qevent->type()) {
    case QEvent::GraphicsSceneMouseDoubleClick:
    case QEvent::GraphicsSceneMousePress: {
      QGraphicsSceneMouseEvent* sceneEvent =
          dynamic_cast<QGraphicsSceneMouseEvent*>(qevent);
      Point pos = Point::fromPx(sceneEvent->scenePos())
                      .mappedToGrid(mEditor.getGridProperties().getInterval());
      switch (sceneEvent->button()) {
        case Qt::LeftButton:
          // fix the current point and add a new point + line
          addNextNetPoint(*schematic, pos);
          return ForceStayInState;
        case Qt::RightButton:
          return ForceStayInState;
        default:
          break;
      }
      break;
    }

    case QEvent::GraphicsSceneMouseRelease: {
      QGraphicsSceneMouseEvent* sceneEvent =
          dynamic_cast<QGraphicsSceneMouseEvent*>(qevent);
      Point pos = Point::fromPx(sceneEvent->scenePos())
                      .mappedToGrid(mEditor.getGridProperties().getInterval());
      switch (sceneEvent->button()) {
        case Qt::RightButton:
          if (sceneEvent->screenPos() ==
              sceneEvent->buttonDownScreenPos(Qt::RightButton)) {
            // switch to next wire mode
            mWireMode = static_cast<WireMode>(mWireMode + 1);
            if (mWireMode == WireMode_COUNT)
              mWireMode = static_cast<WireMode>(0);
            updateWireModeActionsCheckedState();
            updateNetpointPositions(pos);
            return ForceStayInState;
          }
          break;
        default:
          break;
      }
      break;
    }

    case QEvent::GraphicsSceneMouseMove: {
      QGraphicsSceneMouseEvent* sceneEvent =
          dynamic_cast<QGraphicsSceneMouseEvent*>(qevent);
      Q_ASSERT(sceneEvent);
      Point pos = Point::fromPx(sceneEvent->scenePos())
                      .mappedToGrid(mEditor.getGridProperties().getInterval());
      updateNetpointPositions(pos);
      return ForceStayInState;
    }

    default:
      break;
  }

  return PassToParentState;
}
开发者ID:LibrePCB,项目名称:LibrePCB,代码行数:69,代码来源:ses_drawwire.cpp

示例15: ignore

void QEventProto::ignore()
{
  QEvent *item = qscriptvalue_cast<QEvent*>(thisObject());
  if (item)
    item->ignore();
}
开发者ID:xtuple,项目名称:qt-client,代码行数:6,代码来源:qeventproto.cpp


注:本文中的QEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。