本文整理汇总了C++中Gesture::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Gesture::getType方法的具体用法?C++ Gesture::getType怎么用?C++ Gesture::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gesture
的用法示例。
在下文中一共展示了Gesture::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDebug
Gesture *GestureHandler::createGesture(const QString &type, int id, const QHash<QString, QVariant>& attrs,
bool isComposedGesture) const
{
// Creamos el gesto sin su acción
Gesture *ret;
if (isComposedGesture)
ret = this->gestureFact->createComposedGesture(type, id, attrs);
else
ret = this->gestureFact->createSimpleGesture(type, id, attrs);
if (ret == NULL)
return NULL;
// Vemos sobre que ventana se ha ejecutado
Window gestureWindow = this->getGestureWindow(attrs.value(GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID).toInt());
//if (gestureWindow == None)
// return NULL;
QString appClass = this->getAppClass(gestureWindow);
// Creamos y asignamos la acción asociada al gesto
ActionTypeEnum::ActionType actionType = this->config->getAssociatedAction(appClass, ret->getType(),
ret->getNumFingers(), ret->getDirection());
QString actionSettings = this->config->getAssociatedSettings(appClass, ret->getType(), ret->getNumFingers(),
ret->getDirection());
QString timing = this->config->getAssociatedTiming(appClass, ret->getType(), ret->getNumFingers(),
ret->getDirection());
ret->setAction(this->actionFact->createAction(actionType, actionSettings, timing, gestureWindow));
// Mostramos los datos sobre el gesto
qDebug() << "[+] New gesture:";
qDebug() << "\tType -> " << GestureTypeEnum::getValue(ret->getType());
qDebug() << "\tFingers -> " << ret->getNumFingers();
qDebug() << "\tDirection -> " << GestureDirectionEnum::getValue(ret->getDirection());
qDebug() << "\tAction -> " << ActionTypeEnum::getValue(actionType);
qDebug() << "\tTiming -> " << timing;
qDebug() << "\tApp Class -> " << appClass;
return ret;
}
示例2: executeGestureUpdate
void GestureHandler::executeGestureUpdate(const QString &type, int id, const QHash<QString, QVariant>& attrs)
{
// If is an update of the current gesture execute it
if (this->currentGesture != NULL && this->currentGesture->getId() == id && !this->timerTap->isActive()) {
qDebug() << "\tGesture Update" << id << type;
this->currentGesture->setAttrs(attrs);
this->currentGesture->update();
// If no gesture is running the gesture is a TAP, an unsupported gesture, or in Precise a DRAG
} else if (this->currentGesture == NULL) {
Gesture *gesture = this->createGesture(type, id, attrs, false);
if (gesture != NULL) {
this->currentGesture = gesture;
// If the gesture is a tap allow to make a tap & hold
if (gesture->getType() == GestureTypeEnum::TAP) {
this->timerTap->start();
// In Precise the DeltaX and DeltaY attrs in start are 0. Create the Drag here
} else if (gesture->getType() == GestureTypeEnum::DRAG) {
qDebug() << "\tGesture Start";
this->currentGesture->start();
qDebug() << "\tGesture Update" << id << type;
this->currentGesture->update();
}
}
// If is an update whith the timer running it is a DOUBLE_TAP or a TAP_AND_HOLD
} else if (this->currentGesture != NULL && this->timerTap->isActive()) {
this->timerTap->stop();
int currentNumFingers = this->currentGesture->getAttrs().value(GEIS_GESTURE_ATTRIBUTE_TOUCHES).toInt();
int newNumFingers = attrs.value(GEIS_GESTURE_ATTRIBUTE_TOUCHES).toInt();
Gesture *gesture = this->createGesture(type, id, attrs, true);
if (gesture != NULL && currentNumFingers == newNumFingers) {
// TAP_AND_HOLD
if (gesture->getType() == GestureTypeEnum::TAP_AND_HOLD) {
this->currentGesture = gesture;
qDebug() << "\tGesture Start";
this->currentGesture->start();
qDebug() << "\tGesture Update";
this->currentGesture->update();
// DOUBLE_TAP
} else if (gesture->getType() == GestureTypeEnum::DOUBLE_TAP) {
this->currentGesture = gesture;
qDebug() << "\tGesture Start";
this->currentGesture->start();
qDebug() << "\tGesture Update";
this->currentGesture->update();
qDebug() << "\tGesture Finish";
this->currentGesture->finish();
delete this->currentGesture;
this->currentGesture = NULL;
}
}
}
}