Update copyright year in license headers.
[profile/ivi/qtdeclarative.git] / src / qtquick1 / graphicsitems / qdeclarativemousearea.cpp
index 6cd41ff..30c6929 100644 (file)
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -182,8 +182,9 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 
 /*!
     \qmlclass MouseArea QDeclarative1MouseArea
+    \inqmlmodule QtQuick 1
     \ingroup qml-basic-interaction-elements
-    \since 4.7
+    \since QtQuick 1.0
     \brief The MouseArea item enables simple mouse handling.
     \inherits Item
 
@@ -225,9 +226,9 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
     The following example uses a MouseArea in a \l Rectangle that changes
     the \l Rectangle color to red when clicked:
 
-    \snippet doc/src/snippets/declarative/mousearea/mousearea.qml import
+    \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml import
     \codeline
-    \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro
+    \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml intro
 
     \clearfloat
     Many MouseArea signals pass a \l{MouseEvent}{mouse} parameter that contains
@@ -237,13 +238,13 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
     Here is an extension of the previous example that produces a different
     color when the area is right clicked:
 
-    \snippet doc/src/snippets/declarative/mousearea/mousearea.qml intro-extended
+    \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml intro-extended
 
     \sa MouseEvent, {declarative/touchinteraction/mousearea}{MouseArea example}
 */
 
 /*!
-    \qmlsignal MouseArea::onEntered()
+    \qmlsignal QtQuick1::MouseArea::onEntered()
 
     This handler is called when the mouse enters the mouse area.
 
@@ -255,19 +256,45 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onExited()
+    \qmlsignal QtQuick1::MouseArea::onExited()
 
-    This handler is called when the mouse exists the mouse area.
+    This handler is called when the mouse exits the mouse area.
 
     By default the onExited handler is only called while a button is
     pressed. Setting hoverEnabled to true enables handling of
     onExited when no mouse button is pressed.
 
+    The example below shows a fairly typical relationship between
+    two MouseAreas, with \c mouseArea2 on top of \c mouseArea1. Moving the
+    mouse into \c mouseArea2 from \c mouseArea1 will cause \c onExited
+    to be called for \c mouseArea1.
+    \qml
+    Rectangle {
+        width: 400; height: 400
+        MouseArea {
+            id: mouseArea1
+            anchors.fill: parent
+            hoverEnabled: true
+        }
+        MouseArea {
+            id: mouseArea2
+            width: 100; height: 100
+            anchors.centerIn: parent
+            hoverEnabled: true
+        }
+    }
+    \endqml
+
+    If instead you give the two mouseAreas a parent-child relationship,
+    moving the mouse into \c mouseArea2 from \c mouseArea1 will \b not
+    cause \c onExited to be called for \c mouseArea1. Instead, they will
+    both be considered to be simultaneously hovered.
+
     \sa hoverEnabled
 */
 
 /*!
-    \qmlsignal MouseArea::onPositionChanged(MouseEvent mouse)
+    \qmlsignal QtQuick1::MouseArea::onPositionChanged(MouseEvent mouse)
 
     This handler is called when the mouse position changes.
 
@@ -282,7 +309,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onClicked(MouseEvent mouse)
+    \qmlsignal QtQuick1::MouseArea::onClicked(MouseEvent mouse)
 
     This handler is called when there is a click. A click is defined as a press followed by a release,
     both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and
@@ -295,7 +322,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onPressed(MouseEvent mouse)
+    \qmlsignal QtQuick1::MouseArea::onPressed(MouseEvent mouse)
 
     This handler is called when there is a press.
     The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
@@ -309,7 +336,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onReleased(MouseEvent mouse)
+    \qmlsignal QtQuick1::MouseArea::onReleased(MouseEvent mouse)
 
     This handler is called when there is a release.
     The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
@@ -321,7 +348,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onPressAndHold(MouseEvent mouse)
+    \qmlsignal QtQuick1::MouseArea::onPressAndHold(MouseEvent mouse)
 
     This handler is called when there is a long press (currently 800ms).
     The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
@@ -331,7 +358,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onDoubleClicked(MouseEvent mouse)
+    \qmlsignal QtQuick1::MouseArea::onDoubleClicked(MouseEvent mouse)
 
     This handler is called when there is a double-click (a press followed by a release followed by a press).
     The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
@@ -343,7 +370,7 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 */
 
 /*!
-    \qmlsignal MouseArea::onCanceled()
+    \qmlsignal QtQuick1::MouseArea::onCanceled()
 
     This handler is called when mouse events have been canceled, either because an event was not accepted, or
     because another element stole the mouse event handling.
@@ -368,8 +395,8 @@ QDeclarative1MouseArea::~QDeclarative1MouseArea()
 }
 
 /*!
-    \qmlproperty real MouseArea::mouseX
-    \qmlproperty real MouseArea::mouseY
+    \qmlproperty real QtQuick1::MouseArea::mouseX
+    \qmlproperty real QtQuick1::MouseArea::mouseY
     These properties hold the coordinates of the mouse cursor.
 
     If the hoverEnabled property is false then these properties will only be valid
@@ -399,7 +426,7 @@ qreal QDeclarative1MouseArea::mouseY() const
 }
 
 /*!
-    \qmlproperty bool MouseArea::enabled
+    \qmlproperty bool QtQuick1::MouseArea::enabled
     This property holds whether the item accepts mouse events.
 
     By default, this property is true.
@@ -420,7 +447,7 @@ void QDeclarative1MouseArea::setEnabled(bool a)
 }
 
 /*!
-    \qmlproperty bool MouseArea::preventStealing
+    \qmlproperty bool QtQuick1::MouseArea::preventStealing
     \since Quick 1.1
     This property holds whether the mouse events may be stolen from this
     MouseArea.
@@ -453,7 +480,7 @@ void QDeclarative1MouseArea::setPreventStealing(bool prevent)
 }
 
 /*!
-    \qmlproperty MouseButtons MouseArea::pressedButtons
+    \qmlproperty MouseButtons QtQuick1::MouseArea::pressedButtons
     This property holds the mouse buttons currently pressed.
 
     It contains a bitwise combination of:
@@ -465,7 +492,7 @@ void QDeclarative1MouseArea::setPreventStealing(bool prevent)
 
     The code below displays "right" when the right mouse buttons is pressed:
 
-    \snippet doc/src/snippets/declarative/mousearea/mousearea.qml mousebuttons
+    \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml mousebuttons
 
     \sa acceptedButtons
 */
@@ -819,7 +846,7 @@ QVariant QDeclarative1MouseArea::itemChange(GraphicsItemChange change,
 }
 
 /*!
-    \qmlproperty bool MouseArea::hoverEnabled
+    \qmlproperty bool QtQuick1::MouseArea::hoverEnabled
     This property holds whether hover events are handled.
 
     By default, mouse events are only handled in response to a button event, or when a button is
@@ -847,7 +874,7 @@ void QDeclarative1MouseArea::setHoverEnabled(bool h)
 }
 
 /*!
-    \qmlproperty bool MouseArea::containsMouse
+    \qmlproperty bool QtQuick1::MouseArea::containsMouse
     This property holds whether the mouse is currently inside the mouse area.
 
     \warning This property is not updated if the area moves under the mouse: \e containsMouse will not change.
@@ -860,7 +887,7 @@ bool QDeclarative1MouseArea::hovered() const
 }
 
 /*!
-    \qmlproperty bool MouseArea::pressed
+    \qmlproperty bool QtQuick1::MouseArea::pressed
     This property holds whether the mouse area is currently pressed.
 */
 bool QDeclarative1MouseArea::pressed() const
@@ -880,7 +907,7 @@ void QDeclarative1MouseArea::setHovered(bool h)
 }
 
 /*!
-    \qmlproperty Qt::MouseButtons MouseArea::acceptedButtons
+    \qmlproperty QtQuick1::Qt::MouseButtons MouseArea::acceptedButtons
     This property holds the mouse buttons that the mouse area reacts to.
 
     The available buttons are:
@@ -951,14 +978,14 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag()
 }
 
 /*!
-    \qmlproperty Item MouseArea::drag.target
-    \qmlproperty bool MouseArea::drag.active
-    \qmlproperty enumeration MouseArea::drag.axis
-    \qmlproperty real MouseArea::drag.minimumX
-    \qmlproperty real MouseArea::drag.maximumX
-    \qmlproperty real MouseArea::drag.minimumY
-    \qmlproperty real MouseArea::drag.maximumY
-    \qmlproperty bool MouseArea::drag.filterChildren
+    \qmlproperty Item QtQuick1::MouseArea::drag.target
+    \qmlproperty bool QtQuick1::MouseArea::drag.active
+    \qmlproperty enumeration QtQuick1::MouseArea::drag.axis
+    \qmlproperty real QtQuick1::MouseArea::drag.minimumX
+    \qmlproperty real QtQuick1::MouseArea::drag.maximumX
+    \qmlproperty real QtQuick1::MouseArea::drag.minimumY
+    \qmlproperty real QtQuick1::MouseArea::drag.maximumY
+    \qmlproperty bool QtQuick1::MouseArea::drag.filterChildren
 
     \c drag provides a convenient way to make an item draggable.
 
@@ -972,7 +999,7 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag()
     The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity
     of the rectangle is reduced when it is dragged to the right.
 
-    \snippet doc/src/snippets/declarative/mousearea/mousearea.qml drag
+    \snippet doc/src/snippets/qtquick1/mousearea/mousearea.qml drag
 
     \note Items cannot be dragged if they are anchored for the requested 
     \c drag.axis. For example, if \c anchors.left or \c anchors.right was set
@@ -983,7 +1010,7 @@ QDeclarative1Drag *QDeclarative1MouseArea::drag()
     If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas.  This
     enables a parent MouseArea to handle drags, for example, while descendants handle clicks:
 
-    \snippet doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml dragfilter
+    \snippet doc/src/snippets/qtquick1/mousearea/mouseareadragfilter.qml dragfilter
 
 */