本文整理汇总了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;
}
示例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;
}