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

Mark markg85 at gmail.com
Tue Nov 27 15:58:59 CET 2012


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 ;)

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.

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?

Cheers,
Mark

[1] https://bugreports.qt-project.org/browse/QTCOMPONENTS-1276



More information about the Development mailing list