本文整理汇总了C++中qstatemachine::SignalEvent类的典型用法代码示例。如果您正苦于以下问题:C++ SignalEvent类的具体用法?C++ SignalEvent怎么用?C++ SignalEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SignalEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventTest
bool ReceivedMessageTransition::eventTest(QEvent* event) {
if (!QSignalTransition::eventTest(event)) {
return false;
}
QStateMachine::SignalEvent* signalEvent = static_cast<QStateMachine::SignalEvent*>(event);
const QVariant& qVariant(signalEvent->arguments().at(0));
if (!qVariant.canConvert<AddressedMessage>()) {
LOG(ERROR) << "ReceivedMessageTransition::eventTest(): "
<< "cannot convert to AddressedMessage...";
return false;
}
const AddressedMessage& message = qVariant.value<AddressedMessage>();
if (message.getMessage().getMessageNumber() == expectedMessageNumber) {
return true;
} else {
LOG(ERROR) << "ReceivedMessageTransition::eventTest(): "
<< "recevied wrong message number: " << message.getMessage().getMessageNumber()
<< ", expected: " << expectedMessageNumber;
return false;
}
}
示例2: eventTest
bool SignalTransition::eventTest(QEvent *event)
{
Q_ASSERT(event);
if (!QSignalTransition::eventTest(event))
return false;
if (m_guard.isEmpty())
return true;
QQmlContext *outerContext = QQmlEngine::contextForObject(this);
QQmlContext context(outerContext);
QQmlContextData::get(outerContext)->imports->addref();
QQmlContextData::get(&context)->imports = QQmlContextData::get(outerContext)->imports;
QStateMachine::SignalEvent *e = static_cast<QStateMachine::SignalEvent*>(event);
// Set arguments as context properties
int count = e->arguments().count();
QMetaMethod metaMethod = e->sender()->metaObject()->method(e->signalIndex());
for (int i = 0; i < count; i++)
context.setContextProperty(metaMethod.parameterNames()[i], QVariant::fromValue(e->arguments().at(i)));
QQmlExpression expr(m_guard, &context, this);
QVariant result = expr.evaluate();
return result.toBool();
}
示例3: onTransition
void SignalTransition::onTransition(QEvent *event)
{
if (m_signalExpression) {
QStateMachine::SignalEvent *e = static_cast<QStateMachine::SignalEvent*>(event);
m_signalExpression->evaluate(e->arguments());
}
QSignalTransition::onTransition(event);
}
示例4: onTransition
//virtual
void PropertySettingSignalTransition::onTransition(QEvent * e)
{
if (m_qp_targetObject)
{
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
if (!se->arguments().isEmpty())
{
m_qp_targetObject->setProperty(m_propertyName.toLatin1().constData(),se->arguments().at(0));
}
}
QSignalTransition::onTransition(e);
}
示例5: eventTest
/*!
\reimp
The default implementation returns true if the \a event is a
QStateMachine::SignalEvent object and the event's sender and signal index
match this transition, and returns false otherwise.
*/
bool QSignalTransition::eventTest(QEvent *event)
{
Q_D(const QSignalTransition);
if (event->type() == QEvent::StateMachineSignal) {
if (d->signalIndex == -1)
return false;
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event);
return (se->sender() == d->sender)
&& (se->signalIndex() == d->signalIndex);
}
return false;
}
示例6: onEntry
void ReorderState::onEntry(QEvent* event)
{
CardWindowManagerState::onEntry(event);
QStateMachine::SignalEvent* se = static_cast<QStateMachine::SignalEvent*>(event);
if (se && !se->arguments().isEmpty()) {
QPoint pt = se->arguments().at(0).toPoint();
m_wm->enterReorder(pt);
//int slice = se->arguments().at(1).toInt();
//m_grid = new ReorderGrid(m_wm, slice);
}
SystemUiController::instance()->enterOrExitCardReorder(true);
}
示例7: onExit
void ReorderState::onExit(QEvent* event)
{
CardWindowManagerState::onExit(event);
QStateMachine::SignalEvent* se = static_cast<QStateMachine::SignalEvent*>(event);
if (se && !se->arguments().isEmpty()) {
bool canceled = se->arguments().at(0).toBool();
if (canceled)
m_wm->cancelReorder();
}
//delete m_grid;
SystemUiController::instance()->enterOrExitCardReorder(false);
}
示例8: eventTest
bool MaximizeToFocusTransition::eventTest(QEvent* event)
{
if (!QSignalTransition::eventTest(event))
return false;
QStateMachine::SignalEvent* se = static_cast<QStateMachine::SignalEvent*>(event);
CardWindow* win = se->arguments().at(0).value<CardWindow*>();
CardWindowManager* wm = static_cast<CardWindowManager*>(senderObject());
if (win == wm->activeWindow()) {
// window is already focused
SystemUiController::instance()->setCardWindowMaximized(true);
return false;
}
return true;
}
示例9: sipConvertFromType
static PyObject *meth_QStateMachine_SignalEvent_sender(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QStateMachine::SignalEvent *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QStateMachine_SignalEvent, &sipCpp))
{
QObject *sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->sender();
Py_END_ALLOW_THREADS
return sipConvertFromType(sipRes,sipType_QObject,NULL);
}
}