This Patch works for Wayland and X.
BUG: 426582
m_scrollerIsScrolling(false),
m_pinchGestureInProgress(false),
m_mousePress(false),
m_scrollerIsScrolling(false),
m_pinchGestureInProgress(false),
m_mousePress(false),
m_selectionBehavior(NoSelection),
m_autoActivationBehavior(ActivationAndExpansion),
m_mouseDoubleClickAction(ActivateItemOnly),
m_selectionBehavior(NoSelection),
m_autoActivationBehavior(ActivationAndExpansion),
m_mouseDoubleClickAction(ActivateItemOnly),
m_autoActivationTimer(nullptr),
m_swipeGesture(Qt::CustomGesture),
m_twoFingerTapGesture(Qt::CustomGesture),
m_autoActivationTimer(nullptr),
m_swipeGesture(Qt::CustomGesture),
m_twoFingerTapGesture(Qt::CustomGesture),
- m_lastSource(Qt::MouseEventNotSynthesized),
m_oldSelection(),
m_keyboardAnchorIndex(-1),
m_keyboardAnchorPos(0)
m_oldSelection(),
m_keyboardAnchorIndex(-1),
m_keyboardAnchorPos(0)
bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform)
{
m_mousePress = true;
bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform)
{
m_mousePress = true;
- m_lastSource = event->source();
- if (event->source() == Qt::MouseEventSynthesizedByQt) {
+ if (event->source() == Qt::MouseEventSynthesizedByQt && m_isTouchEvent) {
m_view->m_tapAndHoldIndicator->setActive(false);
}
m_view->m_tapAndHoldIndicator->setActive(false);
}
- if (event->source() == Qt::MouseEventSynthesizedByQt && !m_dragActionOrRightClick) {
+ if (event->source() == Qt::MouseEventSynthesizedByQt && !m_dragActionOrRightClick && m_isTouchEvent) {
bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform)
{
m_mousePress = false;
bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform)
{
m_mousePress = false;
+ m_isTouchEvent = false;
if (!m_view) {
return false;
if (!m_view) {
return false;
}
KItemListRubberBand* rubberBand = m_view->rubberBand();
}
KItemListRubberBand* rubberBand = m_view->rubberBand();
- if (event->source() == Qt::MouseEventSynthesizedByQt && !rubberBand->isActive()) {
+ if (event->source() == Qt::MouseEventSynthesizedByQt && !rubberBand->isActive() && m_isTouchEvent) {
Q_UNUSED(transform)
m_mousePress = false;
Q_UNUSED(transform)
m_mousePress = false;
+ m_isTouchEvent = false;
if (!m_model || !m_view) {
return false;
if (!m_model || !m_view) {
return false;
+bool KItemListController::touchBeginEvent(QGestureEvent* event, const QTransform& transform)
+{
+ Q_UNUSED(event)
+ Q_UNUSED(transform)
+
+ m_isTouchEvent = true;
+ return false;
+}
+
void KItemListController::tapTriggered(QTapGesture* tap, const QTransform& transform)
{
static bool scrollerWasActive = false;
void KItemListController::tapTriggered(QTapGesture* tap, const QTransform& transform)
{
static bool scrollerWasActive = false;
m_dragActionOrRightClick = false;
m_isSwipeGesture = false;
m_pinchGestureInProgress = false;
m_dragActionOrRightClick = false;
m_isSwipeGesture = false;
m_pinchGestureInProgress = false;
- m_lastSource = Qt::MouseEventSynthesizedByQt;
scrollerWasActive = m_scrollerIsScrolling;
}
scrollerWasActive = m_scrollerIsScrolling;
}
onPress(tap->hotSpot().toPoint(), tap->position().toPoint(), Qt::NoModifier, Qt::LeftButton);
onRelease(transform.map(tap->position()), Qt::NoModifier, Qt::LeftButton, true);
}
onPress(tap->hotSpot().toPoint(), tap->position().toPoint(), Qt::NoModifier, Qt::LeftButton);
onRelease(transform.map(tap->position()), Qt::NoModifier, Qt::LeftButton, true);
}
+ m_isTouchEvent = false;
{
//the Qt TabAndHold gesture is triggerable with a mouse click, we don't want this
{
//the Qt TabAndHold gesture is triggerable with a mouse click, we don't want this
- if (m_lastSource == Qt::MouseEventNotSynthesized) {
return resizeEvent(static_cast<QGraphicsSceneResizeEvent*>(event), transform);
case QEvent::Gesture:
return gestureEvent(static_cast<QGestureEvent*>(event), transform);
return resizeEvent(static_cast<QGraphicsSceneResizeEvent*>(event), transform);
case QEvent::Gesture:
return gestureEvent(static_cast<QGestureEvent*>(event), transform);
+ case QEvent::TouchBegin:
+ return touchBeginEvent();
bool wheelEvent(QGraphicsSceneWheelEvent* event, const QTransform& transform);
bool resizeEvent(QGraphicsSceneResizeEvent* event, const QTransform& transform);
bool gestureEvent(QGestureEvent* event, const QTransform& transform);
bool wheelEvent(QGraphicsSceneWheelEvent* event, const QTransform& transform);
bool resizeEvent(QGraphicsSceneResizeEvent* event, const QTransform& transform);
bool gestureEvent(QGestureEvent* event, const QTransform& transform);
+ bool touchBeginEvent(QGestureEvent* event, const QTransform& transform);
void tapTriggered(QTapGesture* tap, const QTransform& transform);
void tapAndHoldTriggered(QGestureEvent* event, const QTransform& transform);
void pinchTriggered(QGestureEvent* event, const QTransform& transform);
void tapTriggered(QTapGesture* tap, const QTransform& transform);
void tapAndHoldTriggered(QGestureEvent* event, const QTransform& transform);
void pinchTriggered(QGestureEvent* event, const QTransform& transform);
bool m_scrollerIsScrolling;
bool m_pinchGestureInProgress;
bool m_mousePress;
bool m_scrollerIsScrolling;
bool m_pinchGestureInProgress;
bool m_mousePress;
SelectionBehavior m_selectionBehavior;
AutoActivationBehavior m_autoActivationBehavior;
MouseDoubleClickAction m_mouseDoubleClickAction;
SelectionBehavior m_selectionBehavior;
AutoActivationBehavior m_autoActivationBehavior;
MouseDoubleClickAction m_mouseDoubleClickAction;
Qt::GestureType m_swipeGesture;
Qt::GestureType m_twoFingerTapGesture;
Qt::GestureType m_swipeGesture;
Qt::GestureType m_twoFingerTapGesture;
- Qt::MouseEventSource m_lastSource;
/**
* When starting a rubberband selection during a Shift- or Control-key has been
/**
* When starting a rubberband selection during a Shift- or Control-key has been
m_dropIndicator()
{
setAcceptHoverEvents(true);
m_dropIndicator()
{
setAcceptHoverEvents(true);
+ setAcceptTouchEvents(true);
m_sizeHintResolver = new KItemListSizeHintResolver(this);
m_sizeHintResolver = new KItemListSizeHintResolver(this);
// Qt
#include <QTouchEvent>
#include <QApplication>
// Qt
#include <QTouchEvent>
#include <QApplication>
+#include <QGraphicsWidget>
KTwoFingerTapRecognizer::KTwoFingerTapRecognizer() :
QGestureRecognizer(),
KTwoFingerTapRecognizer::KTwoFingerTapRecognizer() :
QGestureRecognizer(),
QGestureRecognizer::Result KTwoFingerTapRecognizer::recognize(QGesture* gesture, QObject* watched, QEvent* event)
{
QGestureRecognizer::Result KTwoFingerTapRecognizer::recognize(QGesture* gesture, QObject* watched, QEvent* event)
{
+ if (qobject_cast<QGraphicsWidget*>(watched)) {
+ return Ignore;
+ }
KTwoFingerTap* const kTwoFingerTap = static_cast<KTwoFingerTap*>(gesture);
const QTouchEvent* touchEvent = static_cast<const QTouchEvent*>(event);
KTwoFingerTap* const kTwoFingerTap = static_cast<KTwoFingerTap*>(gesture);
const QTouchEvent* touchEvent = static_cast<const QTouchEvent*>(event);