本文整理汇总了C++中QWaylandInputDevice::sendFullKeyEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ QWaylandInputDevice::sendFullKeyEvent方法的具体用法?C++ QWaylandInputDevice::sendFullKeyEvent怎么用?C++ QWaylandInputDevice::sendFullKeyEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWaylandInputDevice
的用法示例。
在下文中一共展示了QWaylandInputDevice::sendFullKeyEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventFilter
bool LipstickCompositorWindow::eventFilter(QObject *obj, QEvent *event)
{
#if QT_VERSION >= 0x050202
if (obj == window() && m_interceptingTouch) {
switch (event->type()) {
case QEvent::TouchUpdate: {
QTouchEvent *te = static_cast<QTouchEvent *>(event);
// If we get press/release, don't intercept the event, but send it through QQuickWindow.
// These are sent through to QQuickWindow so that the integrity of the touch
// handling is maintained.
if (te->touchPointStates() & (Qt::TouchPointPressed | Qt::TouchPointReleased))
return false;
handleTouchEvent(static_cast<QTouchEvent *>(event));
return true;
}
case QEvent::TouchEnd: // Intentional fall through...
case QEvent::TouchCancel:
obj->removeEventFilter(this);
m_interceptingTouch = false;
default:
break;
}
return false;
}
#else
Q_UNUSED(obj);
#endif
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
QWaylandSurface *m_surface = surface();
if (m_surface && (m_grabbedKeys.contains(ke->key()) || m_pressedGrabbedKeys.keys.contains(ke->key())) && !ke->isAutoRepeat()) {
QWaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
if (event->type() == QEvent::KeyPress) {
if (m_pressedGrabbedKeys.keys.isEmpty()) {
QWaylandSurface *old = inputDevice->keyboardFocus();
m_pressedGrabbedKeys.oldFocus = old;
inputDevice->setKeyboardFocus(m_surface);
}
m_pressedGrabbedKeys.keys << ke->key();
}
inputDevice->sendFullKeyEvent(ke);
if (event->type() == QEvent::KeyRelease) {
m_pressedGrabbedKeys.keys.removeOne(ke->key());
if (m_pressedGrabbedKeys.keys.isEmpty()) {
inputDevice->setKeyboardFocus(m_pressedGrabbedKeys.oldFocus);
if (m_grabbedKeys.isEmpty())
qApp->removeEventFilter(this);
}
}
return true;
}
}
return false;
}
示例2: eventFilter
bool LipstickCompositorWindow::eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
QWaylandSurface *m_surface = surface();
if (m_surface && m_grabbedKeys.contains(ke->key())) {
QWaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
inputDevice->sendFullKeyEvent(m_surface, ke);
return true;
}
}
return false;
}