本文整理汇总了C++中QEvent::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QEvent::type方法的具体用法?C++ QEvent::type怎么用?C++ QEvent::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QEvent
的用法示例。
在下文中一共展示了QEvent::type方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
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());
}
示例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;
}
示例3: 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;
}
示例4: processEventFromChild
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;
}
}
示例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;
}
示例6: inserActionIntoModel
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 );
}
示例7:
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);
}
示例8: eventFilter
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;
}
示例9: 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
示例10:
/*
* Given an approximate classname and a qt instance, try to improve the resolution of the name
* by using the various Qt rtti mechanisms for QObjects, QEvents and so on
*/
const char *
qyoto_resolve_classname_qtcore(smokeqyoto_object * o)
{
#define SET_SMOKEQYOTO_OBJECT(className) \
{ \
Smoke::ModuleIndex mi = Smoke::findClass(className); \
o->classId = mi.index; \
o->smoke = mi.smoke; \
}
if (o->smoke->isDerivedFrom(o->smoke->classes[o->classId].className, "QEvent")) {
QEvent * qevent = (QEvent *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QEvent", true).index);
switch (qevent->type()) {
case QEvent::Timer:
SET_SMOKEQYOTO_OBJECT("QTimerEvent")
break;
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
SET_SMOKEQYOTO_OBJECT("QMouseEvent")
break;
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::ShortcutOverride:
SET_SMOKEQYOTO_OBJECT("QKeyEvent")
break;
case QEvent::FocusIn:
case QEvent::FocusOut:
SET_SMOKEQYOTO_OBJECT("QFocusEvent")
break;
case QEvent::Enter:
case QEvent::Leave:
SET_SMOKEQYOTO_OBJECT("QEvent")
break;
case QEvent::Paint:
SET_SMOKEQYOTO_OBJECT("QPaintEvent")
break;
case QEvent::Move:
SET_SMOKEQYOTO_OBJECT("QMoveEvent")
break;
case QEvent::Resize:
SET_SMOKEQYOTO_OBJECT("QResizeEvent")
break;
case QEvent::Create:
case QEvent::Destroy:
SET_SMOKEQYOTO_OBJECT("QEvent")
break;
case QEvent::Show:
SET_SMOKEQYOTO_OBJECT("QShowEvent")
break;
case QEvent::Hide:
SET_SMOKEQYOTO_OBJECT("QHideEvent")
break;
case QEvent::Close:
SET_SMOKEQYOTO_OBJECT("QCloseEvent")
break;
case QEvent::Quit:
case QEvent::ParentChange:
case QEvent::ParentAboutToChange:
case QEvent::ThreadChange:
case QEvent::WindowActivate:
case QEvent::WindowDeactivate:
case QEvent::ShowToParent:
case QEvent::HideToParent:
SET_SMOKEQYOTO_OBJECT("QEvent")
break;
case QEvent::Wheel:
SET_SMOKEQYOTO_OBJECT("QWheelEvent")
break;
case QEvent::WindowTitleChange:
case QEvent::WindowIconChange:
case QEvent::ApplicationWindowIconChange:
case QEvent::ApplicationFontChange:
case QEvent::ApplicationLayoutDirectionChange:
case QEvent::ApplicationPaletteChange:
case QEvent::PaletteChange:
SET_SMOKEQYOTO_OBJECT("QEvent")
break;
case QEvent::Clipboard:
SET_SMOKEQYOTO_OBJECT("QClipboardEvent")
break;
case QEvent::Speech:
case QEvent::MetaCall:
case QEvent::SockAct:
case QEvent::WinEventAct:
case QEvent::DeferredDelete:
SET_SMOKEQYOTO_OBJECT("QEvent")
break;
case QEvent::DragEnter:
SET_SMOKEQYOTO_OBJECT("QDragEnterEvent")
break;
case QEvent::DragLeave:
SET_SMOKEQYOTO_OBJECT("QDragLeaveEvent")
break;
case QEvent::DragMove:
//.........这里部分代码省略.........
示例11: switch
static void
qeventTypeResolver(JSmoke::Object::Instance * instance)
{
Smoke::ModuleIndex classId = instance->classId;
Smoke * smoke = classId.smoke;
QEvent * qevent = reinterpret_cast<QEvent*>(instance->cast(JSmoke::Global::QEventClassId));
switch (qevent->type()) {
case QEvent::Timer:
instance->classId = smoke->findClass("QTimerEvent");
break;
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
instance->classId = smoke->findClass("QMouseEvent");
break;
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::ShortcutOverride:
instance->classId = smoke->findClass("QKeyEvent");
break;
case QEvent::FocusIn:
case QEvent::FocusOut:
instance->classId = smoke->findClass("QFocusEvent");
break;
case QEvent::Enter:
case QEvent::Leave:
instance->classId = smoke->findClass("QEvent");
break;
case QEvent::Paint:
instance->classId = smoke->findClass("QPaintEvent");
break;
case QEvent::Move:
instance->classId = smoke->findClass("QMoveEvent");
break;
case QEvent::Resize:
instance->classId = smoke->findClass("QResizeEvent");
break;
case QEvent::Create:
case QEvent::Destroy:
instance->classId = smoke->findClass("QEvent");
break;
case QEvent::Show:
instance->classId = smoke->findClass("QShowEvent");
break;
case QEvent::Hide:
instance->classId = smoke->findClass("QHideEvent");
case QEvent::Close:
instance->classId = smoke->findClass("QCloseEvent");
break;
case QEvent::Quit:
case QEvent::ParentChange:
case QEvent::ParentAboutToChange:
case QEvent::ThreadChange:
case QEvent::WindowActivate:
case QEvent::WindowDeactivate:
case QEvent::ShowToParent:
case QEvent::HideToParent:
instance->classId = smoke->findClass("QEvent");
break;
case QEvent::Wheel:
instance->classId = smoke->findClass("QWheelEvent");
break;
case QEvent::WindowTitleChange:
case QEvent::WindowIconChange:
case QEvent::ApplicationWindowIconChange:
case QEvent::ApplicationFontChange:
case QEvent::ApplicationLayoutDirectionChange:
case QEvent::ApplicationPaletteChange:
case QEvent::PaletteChange:
instance->classId = smoke->findClass("QEvent");
break;
case QEvent::Clipboard:
instance->classId = smoke->findClass("QClipboardEvent");
break;
case QEvent::Speech:
case QEvent::MetaCall:
case QEvent::SockAct:
case QEvent::WinEventAct:
case QEvent::DeferredDelete:
instance->classId = smoke->findClass("QEvent");
break;
case QEvent::DragEnter:
instance->classId = smoke->findClass("QDragEnterEvent");
break;
case QEvent::DragLeave:
instance->classId = smoke->findClass("QDragLeaveEvent");
break;
case QEvent::DragMove:
instance->classId = smoke->findClass("QDragMoveEvent");
case QEvent::Drop:
instance->classId = smoke->findClass("QDropEvent");
break;
case QEvent::DragResponse:
instance->classId = smoke->findClass("QDragResponseEvent");
break;
case QEvent::ChildAdded:
case QEvent::ChildRemoved:
case QEvent::ChildPolished:
instance->classId = smoke->findClass("QChildEvent");
//.........这里部分代码省略.........
示例12: processPositioningSceneEvent
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;
}
示例13: processSceneEvent
SES_Base::ProcRetVal SES_AddNetLabel::processSceneEvent(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(), mEditor.getGridProperties().getInterval());
switch (sceneEvent->button())
{
case Qt::LeftButton:
{
fixLabel(pos);
addLabel(*schematic);
updateLabel(*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(), mEditor.getGridProperties().getInterval());
switch (sceneEvent->button())
{
case Qt::RightButton:
{
if (sceneEvent->screenPos() == sceneEvent->buttonDownScreenPos(Qt::RightButton)) {
mEditCmd->rotate(Angle::deg90(), pos, true);
return ForceStayInState;
}
break;
}
default:
break;
}
break;
}
case QEvent::GraphicsSceneMouseMove:
{
QGraphicsSceneMouseEvent* sceneEvent = dynamic_cast<QGraphicsSceneMouseEvent*>(qevent);
Q_ASSERT(sceneEvent);
Point pos = Point::fromPx(sceneEvent->scenePos(), mEditor.getGridProperties().getInterval());
updateLabel(*schematic, pos);
return ForceStayInState;
}
default:
break;
}
return PassToParentState;
}