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


C++ QWheelEvent::state方法代码示例

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


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

示例1: eventFilter

// Handle events on behalf of the text area.
bool QsciScintillaBase::eventFilter(QObject *o, QEvent *e)
{
    if (o != txtarea)
        return QWidget::eventFilter(o, e);

    bool used = true;

    switch (e->type())
    {
    case QEvent::ContextMenu:
        contextMenuEvent(static_cast<QContextMenuEvent *>(e));
        break;

    case QEvent::DragEnter:
        dragEnterEvent(static_cast<QDragEnterEvent *>(e));
        break;

    case QEvent::DragLeave:
        dragLeaveEvent(static_cast<QDragLeaveEvent *>(e));
        break;

    case QEvent::DragMove:
        dragMoveEvent(static_cast<QDragMoveEvent *>(e));
        break;

    case QEvent::Drop:
        dropEvent(static_cast<QDropEvent *>(e));
        break;

    case QEvent::MouseButtonDblClick:
        mouseDoubleClickEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::MouseButtonPress:
        mousePressEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::MouseButtonRelease:
        mouseReleaseEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::MouseMove:
        mouseMoveEvent(static_cast<QMouseEvent *>(e));
        break;

    case QEvent::Paint:
        paintEvent(static_cast<QPaintEvent *>(e));
        break;

    case QEvent::Resize:
        resizeEvent(static_cast<QResizeEvent *>(e));
        break;

    case QEvent::Wheel:
        {
            QWheelEvent *we = static_cast<QWheelEvent *>(e);

            setFocus();

            if (we->orientation() == Horizontal || we->state() & ShiftButton)
                QApplication::sendEvent(hsb, we);
            else if (we->orientation() == Vertical)
                QApplication::sendEvent(vsb, we);

            break;
        }

    default:
        used = false;
    }

    return used;
}
开发者ID:wdobbie,项目名称:Nexpo,代码行数:74,代码来源:qsciscintillabase.cpp

示例2: isRecording

/*! Reimplementation of the \c QObject function. Always returns \p false (meaning event is \e not
  handled and should be forwarded to the \p qglviewer).

  When EventRecorder isRecording(), the following \c QEvent::type are recorded in an internal data
  structure: \c KeyPress, \c KeyRelease, \c MouseButtonPress, \c MouseButtonRelease, \c
  MouseButtonDblClick, \c MouseMove, \c Wheel and \c Timer (used by QGLViewer::animate()). Does
  nothing when isRecording() is \c false.

  You may overload this method to filter other \c QEvent::type (your implementation should probably
  call this function).

  Other specific events can be recorded using recordFrameState() and recordCustomEvent(). */
bool EventRecorder::eventFilter(QObject *, QEvent *e)
{
  if (isRecording())
    {
      bool record = true;
      switch (e->type())
	{
	case QEvent::KeyPress:
	case QEvent::KeyRelease:
	  {
	    QKeyEvent* ke = (QKeyEvent*)(e);
	    eventRecords_[eventIndex_].event.keyEvent = new QKeyEvent(e->type(), ke->key(), ke->ascii(), int(ke->state()));
	    break;
	  }
	case QEvent::MouseButtonPress:
	case QEvent::MouseButtonRelease:
	case QEvent::MouseButtonDblClick:
	case QEvent::MouseMove:
	  {
	    QMouseEvent* me = (QMouseEvent*)(e);
	    eventRecords_[eventIndex_].event.mouseEvent = new QMouseEvent(e->type(), me->pos(), int(me->button()), int(me->state()));
	    break;
	  }
	case QEvent::Wheel:
	  {
	    QWheelEvent* we = (QWheelEvent*)(e);
	    eventRecords_[eventIndex_].event.wheelEvent = new QWheelEvent(we->pos(), we->delta(), int(we->state()));
	    break;
	  }
	case QEvent::Timer:
	  {
	    eventRecords_[eventIndex_].event.keyEvent = NULL; // or any other pointer
	    break;
	  }
	default:
	    record = false;
	  break;
	}

      if (record)
	{
	  eventRecords_[eventIndex_].type = e->type();
	  eventRecords_[eventIndex_].time = time_.elapsed();
	  eventIndex_++;
	}
    }
  return false;
}
开发者ID:151706061,项目名称:libQGLViewer,代码行数:60,代码来源:eventRecorder.cpp


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