[Development] Can the QML Flickable component inherit from a MouseArea in Qt5?

Alan Alpert 416365416c at gmail.com
Tue Nov 27 22:46:43 CET 2012


On Tue, Nov 27, 2012 at 6:58 AM, Mark <markg85 at gmail.com> wrote:
> Hi,
>
> I just opened this feature request [1] and usually i don't open
> another question for the same stuff on the development list. Guess
> this time is different ;)

Even if this time is different, I'm still going to put my comments on
the idea into the JIRA item so it can be more easily found in the
future.

> Considering that QtQuick 2.0 is very different compared to 1.1 i'm
> wondering if this late header change could be added by someone to the
> Qt5 sources.
>
> The rationale behind this question is simple. A flickable is already
> doing some mouse interaction. You can press and move
> up/down/left/right yet no mouse events are exposed. In my project i
> have a ListView where i would like to know when i clicked on the
> ListView. It's easy to work around it, but it would be even easier if
> the Flickable element would just inherit from the MouseArea element.
>
> If i'm right, it's only a header change:
>
> class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem
> to
> class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickMouseArea
>
> and adding an include for the QQuickMouseArea in the QQuickFlickable header.

It also means adding all the functionality in
http://qt-project.org/doc/qt-5.0/qml-qtquick2-mousearea.html. A lot of
that will be broken because of the custom mouse handling in Flickable.

>
> Since QQuickMouseArea inherits from QQuickItem i guess there won't be
> any issue with the other code. I haven't tested any of this nor
> compiled it. I'm still running Qt 4.8.
>
> I would very much like to see this in QtQuick 2.0 (Qt5).
> What's your opinion on this?

Even if this were to be done, it's too big an API change to make it
into Qt5 at this point. QtQuick 2.1 at the earliest.

--
Alan Alpert



More information about the Development mailing list