aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-07-03 12:29:57 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-04 02:45:03 +0200
commit9bf96613c1be7d4df7132a9c3c9ac1a8740f698f (patch)
tree351c19417586bf5ec688af3f8b40f91c9f1d1a5e /src
parentfc909a49d3e8fa2132bf0951499a1d5cb1d541ca (diff)
Allow mouse interaction with 0 opacity items.
Don't filter event delivery to items with 0 opacity, and update the documentation the for opacity, visible and enabled properties and how each affects event delivery. Task-number: QTBUG-19193 Change-Id: Id48e4af763c9a7bbcc13b303342d303155dcadc9 Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickview.cpp2
-rw-r--r--src/quick/items/qquickcanvas.cpp11
-rw-r--r--src/quick/items/qquickitem.cpp32
-rw-r--r--src/quick/items/qquickmousearea.cpp2
4 files changed, 25 insertions, 22 deletions
diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp
index 5f66f00d8a..c82c4e839d 100644
--- a/src/plugins/accessible/quick/qaccessiblequickview.cpp
+++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp
@@ -118,7 +118,7 @@ QString QAccessibleQuickView::text(QAccessible::Text text) const
*/
static QQuickItem *childAt_helper(QQuickItem *item, int x, int y)
{
- if (item->opacity() == 0.0 || !item->isVisible() || !item->isEnabled())
+ if (!item->isVisible() || !item->isEnabled())
return 0;
if (item->flags() & QQuickItem::ItemClipsChildrenToShape) {
diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp
index a242ca1111..7e0f482ee0 100644
--- a/src/quick/items/qquickcanvas.cpp
+++ b/src/quick/items/qquickcanvas.cpp
@@ -1146,8 +1146,6 @@ bool QQuickCanvasPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouse
Q_Q(QQuickCanvas);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- if (itemPrivate->opacity() == 0.0)
- return false;
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
QPointF p = item->mapFromScene(event->windowPos());
@@ -1306,8 +1304,6 @@ bool QQuickCanvasPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
Qt::KeyboardModifiers modifiers, bool &accepted)
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- if (itemPrivate->opacity() == 0.0)
- return false;
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
QPointF p = item->mapFromScene(scenePos);
@@ -1374,8 +1370,6 @@ bool QQuickCanvasPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
{
Q_Q(QQuickCanvas);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- if (itemPrivate->opacity() == 0.0)
- return false;
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
QPointF p = item->mapFromScene(event->posF());
@@ -1514,9 +1508,6 @@ bool QQuickCanvasPrivate::deliverTouchPoints(QQuickItem *item, QTouchEvent *even
{
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- if (qFuzzyIsNull(itemPrivate->opacity()))
- return false;
-
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
for (int i=0; i<newPoints.count(); i++) {
QPointF p = item->mapFromScene(newPoints[i].scenePos());
@@ -1770,7 +1761,7 @@ bool QQuickCanvasPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte
Q_Q(QQuickCanvas);
bool accepted = false;
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- if (itemPrivate->opacity() == 0.0 || !item->isVisible() || !item->isEnabled())
+ if (!item->isVisible() || !item->isEnabled())
return false;
QPointF p = item->mapFromScene(event->pos());
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index df557f1e01..9c43645f1e 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2818,16 +2818,31 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
explicit property changes. In such cases it may be better to use the
\l opacity property instead.)
- Setting this property to \c false automatically causes \l focus to be set
- to \c false, and this item will longer receive mouse and keyboard events.
- (In contrast, setting the \l opacity to 0 does not affect the \l focus
- property and the receiving of key events.)
+ If this property is set to \c false, the item will no longer receive mouse
+ events, but will continue to receive key events and will retain the keyboard
+ \l focus if it has been set. (In contrast, setting the \l enabled property
+ to \c false stops both mouse and keyboard events, and also removes focus
+ from the item.)
\note This property's value is only affected by changes to this property or
the parent's \c visible property. It does not change, for example, if this
item moves off-screen, or if the \l opacity changes to 0.
*/
+/*!
+ \qmlproperty bool QtQuick2::Item::enabled
+
+ This property holds whether the item receives mouse and keyboard events.
+ By default this is true.
+
+ Setting this property directly affects the \c enabled value of child
+ items. When set to \c false, the \c enabled values of all child items also
+ become \c false. When set to \c true, the \c enabled values of child items
+ are returned to \c true, unless they have explicitly been set to \c false.
+
+ Setting this property to \c false automatically causes \l activeFocus to be
+ set to \c false, and this item will longer receive keyboard events.
+*/
/*!
\qmlproperty AnchorLine QtQuick2::Item::anchors.top
@@ -4063,11 +4078,10 @@ void QQuickItem::setZ(qreal v)
\endqml
\endtable
- If an item's opacity is set to 0, the item will no longer receive mouse
- events, but will continue to receive key events and will retain the keyboard
- \l focus if it has been set. (In contrast, setting the \l visible property
- to \c false stops both mouse and keyboard events, and also removes focus
- from the item.)
+ Changing an items opacity will not affect delivery of input events. (In contrast
+ setting \l visible property to \c false stops mouse events, and setting the
+ \l enabled property to \c false stops mouse and keyboard events, and also removes
+ active focus from the item.)
*/
/*!
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 17458abee6..6897e3d904 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -271,8 +271,6 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
//But specific to MouseArea, so doesn't belong in canvas
Q_Q(const QQuickMouseArea);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- if (itemPrivate->opacity() == 0.0)
- return false;
if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
QPointF p = item->mapFromScene(sp);