PinchArea always reports 1.0 scale when a MouseArea is inside of it

Bug #1296832 reported by Ugo Riboni
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Invalid
Low
Zsombor Egri
gallery-app (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

If there's a MouseArea nested inside a PinchArea, the latter will always report scale 1.0 during a pinch gesture, no matter what the actual scale of the pinch is. Removing or disabling the MouseArea will give the correct behaviour, with the scale changing according to the gesture.

The attached example shows the problem.

This problem didn't happen before the recent Qt upgrade.

Revision history for this message
Ugo Riboni (uriboni) wrote :
Revision history for this message
Zsombor Egri (zsombi) wrote :

There is already a bug reported upstream, seems it got broken in Qt5.1.1. https://bugreports.qt-project.org/browse/QTBUG-35273

Changed in ubuntu-ui-toolkit:
status: New → Confirmed
Revision history for this message
Zsombor Egri (zsombi) wrote :

Changing MainView to Item seems to solve the PinchaArea + MouseArea issue, so need to investigate further.

Changed in ubuntu-ui-toolkit:
assignee: nobody → Zsombor Egri (zsombi)
Revision history for this message
Zsombor Egri (zsombi) wrote :

It ended up that the MouseArea inside the MainView's contentsClipper component is the guilty, which after all is related to the upstream bug.

Revision history for this message
Zsombor Egri (zsombi) wrote :

import QtQuick 2.0

Item {
    width: 100
    height: 62

    PinchArea {
        id: pinchArea
        anchors.fill: parent

        pinch.minimumScale: 0.5
        pinch.maximumScale: 2.0
        pinch.target: img
        pinch.dragAxis: Pinch.NoDrag

        onPinchStarted: {
            console.log("STARTED", pinch.scale, pinch.rotation, pinch.pointCount)
        }

        onPinchUpdated: {
            console.log("UPDATED", pinch.scale, pinch.rotation, pinch.pointCount)
        }

        onPinchFinished: {
            console.log("FINISHED", pinch.scale, pinch.rotation, pinch.pointCount)
        }

        MouseArea {
            id: m
            anchors.fill: parent
            onPressed: {
                mouse.accepted = false
                console.log("PRESSED")
            }
            onClicked: console.log("CLICKED")
        }
    }

    MouseArea {
        anchors.fill: parent
        onPressed: {
            mouse.accepted = false
            console.log("OUTER PRESSED")
        }
    }

    Rectangle {
        id: img
        width: parent.width / 2
        height: parent.height / 2
        anchors.centerIn: parent
        color: "green"
    }
}

Revision history for this message
Zsombor Egri (zsombi) wrote :

As workaround, use this to handle double clicks in the PinchArea and remove MouseArea from there:

        MultiPointTouchArea {
            anchors.fill: parent
            Timer {
                id: dblTapTimeout
                interval: 600
                repeat: false
                onTriggered: dblTapHandler.pressCount = 0
            }

            touchPoints: TouchPoint {
                id: dblTapHandler
                property int pressCount: 0
                onPressedChanged: {
                    if (pressed) {
                        pressCount++;
                        dblTapTimeout.running = true;
                    } else {
                        if (pressCount === 2) {
                            // handle double click
                            console.log("DBLTap")
                            pressCount = 0;
                            dblTapTimeout.stop();
                        }
                    }
                }
            }
        }

This could be kept even if the upstream bug gets fixed, and have a MouseArea that is enabled only if the form factor hints desktop. Those hints will land later to UITK.

Changed in ubuntu-ui-toolkit:
importance: Critical → High
Ara Pulido (ara)
tags: added: desktop-touch
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
milestone: none → june-2014
Revision history for this message
Bill Filler (bfiller) wrote :

We've tried the above workaround. I works nicely on the device. However it does not work correctly on the desktop with touch pad or mouse. We're seeing the following issues:

1) double clicking on the desktop is not causing trigger, both using touchpad and a mouse
2) there is no way to capture MouseWheel events in MultiPointTouchArea. We need to capture these events to handle horizontal scrolling (see this MR https://code.launchpad.net/~artmello/gallery-app/gallery-app-horizontal_scroll/+merge/212237)

Not sure how to proceed unless we can conditionally use MouseArea on desktopMode and MultiPointTouchArea on device. Can we put pressure on upstream to get the real fix working? Lots of workaround here and none are ideal..

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gallery-app (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gallery-app - 0.0.67+14.04.20140408.1-0ubuntu1

---------------
gallery-app (0.0.67+14.04.20140408.1-0ubuntu1) trusty; urgency=low

  [ Bill Filler ]
  * skip broken test until root cause can be found

  [ Arthur Mello ]
  * Make sure that album cover will be not behind header at album edit
    screen (LP: #1294291)
  * Add unittest to check if only videos on the correct path are beeing
    added to gallery on device
  * Add an overlay play icon over Video preview on media navigation (LP:
    #1294282)
  * Apply a similar workaround to the one suggested by Zsombor to work
    around bug #1296832 to temporarily replace MouseAreas within
    PinchAreas (LP: #1296832, #1288695)

  [ Ugo Riboni ]
  * Fix album navigation, allowing to page all the way to the last page,
    and to close the album by paging to the cover. (LP: #1287355)
  * Apply a similar workaround to the one suggested by Zsombor to work
    around bug #1296832 to temporarily replace MouseAreas within
    PinchAreas (LP: #1296832, #1288695)
  * fix autopilot test

  [ Leo Arias ]
  * Properly override the toolkit toolbar autopilot helper.
  * On the autopilot helpers to click a toolbar button, check that the
    toolbar is opened first. (LP: #1302706)
 -- Ubuntu daily release <email address hidden> Tue, 08 Apr 2014 18:51:30 +0000

Changed in gallery-app (Ubuntu):
status: Confirmed → Fix Released
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
importance: High → Low
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
status: Confirmed → Invalid
milestone: june-2014 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.