[Qt-qml] Overlapping MouseAreas / big cursor for recording video

Cornelius Hald hald at icandy.de
Mon Aug 30 09:20:09 CEST 2010


On Mon, 2010-08-30 at 03:18 +0200, michael.brasser at nokia.com wrote:
> On 30/08/2010, at 12:59 AM, ext Cornelius Hald wrote:
> > On Sun, 2010-08-29 at 15:55 +0200, Cornelius Hald wrote:
> >> MouseArea {
> >>    anchors.fill: parent
> >>    hoverEnabled: true
> >>    acceptedButtons: Qt.RightButton
> >>    onMousePositionChanged: {
> >>        cursor.x = mouse.x;
> >>        cursor.y = mouse.y;
> >>    }
> >> }
> >> 
> >> Now this MouseArea is only listening to right-clicks and will pass
> >> through the left-clicks to the underlying items.
> > 
> > I just noticed that now the custom cursor is not following the mouse
> > pointer if moved while the left mouse button is pressed. So the result
> > doesn't look good if I, for example, flick a list.
> > 
> > Pointers on how to do that properly would be very welcome :)
> 
> There isn't a real good way to do this with MouseArea (that I can see) with the current way mouse grabbing is handled -- basically, if any item accepts a press, it becomes the mouse grabber, and receives the rest of the mouse events until the release (see the Graphics View documentation for more on the details of mouse grabbing).
> 
> You could try creating a custom item in C++ that subclasses QDeclarativeItem, uses setFiltersChildEvents to filter all mouse events, and displays a "fake" cursor accordingly. (That might be a cool component for http://developer.qt.nokia.com/wiki/QtQuickOpenComponents, actually)

Thank you, I will try this once I get started with the C++ side of
things. A generic component would be good, especially because the
recorded videos do not even contain the normal mouse pointer, so it's
quite confusing to watch such a video.

Once I have something, I'll post it here. But that probably might take
so more time.

Cheers,
Conny





More information about the Qt-qml mailing list