diff options
144 files changed, 310 insertions, 307 deletions
diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml index 08851d0..6210e46 100644 --- a/demos/declarative/calculator/CalcButton.qml +++ b/demos/declarative/calculator/CalcButton.qml @@ -15,7 +15,7 @@ Rectangle { Text { id: label; anchors.centerIn: parent; color: palette.buttonText } - MouseRegion { + MouseArea { id: clickRegion anchors.fill: parent onClicked: { diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml index c12b642..86ac948 100644 --- a/demos/declarative/flickr/common/MediaButton.qml +++ b/demos/declarative/flickr/common/MediaButton.qml @@ -16,7 +16,7 @@ Item { source: "pics/button-pressed.png" opacity: 0 } - MouseRegion { + MouseArea { id: mouseRegion anchors.fill: buttonImage onClicked: { container.clicked(); } diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index b24b296..3dfd1f3 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -62,7 +62,7 @@ Item { anchors.right: container.right } - MouseRegion { + MouseArea { id: mouseRegion anchors.fill: buttonImage onClicked: { container.state = container.state=="Edit" ? "" : "Edit" } diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml index fa1645c..05a87e7 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/common/Slider.qml @@ -27,7 +27,7 @@ Item { GradientStop { position: 1.0; color: "gray" } } - MouseRegion { + MouseArea { anchors.fill: parent; drag.target: parent drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: slider.xMax+2 onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; } diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index 173021b..8cd47b4 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -17,7 +17,7 @@ Item { opacity: 0.4 scale: 0.5 } - MouseRegion { + MouseArea { anchors.fill: container onClicked: { container.clicked() } } diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index 3848f12..1ca3cdc 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -61,7 +61,7 @@ Item { } } - MouseRegion { anchors.fill: wrapper; onClicked: { photoClicked() } } + MouseArea { anchors.fill: wrapper; onClicked: { photoClicked() } } states: [ State { diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml index 770330c..4ba6b19 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/mobile/Button.qml @@ -18,7 +18,7 @@ Item { source: "images/toolbutton.sci" width: container.width; height: container.height } - MouseRegion { + MouseArea { id: mouseRegion anchors.fill: buttonImage onClicked: { container.clicked(); } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 6c12896..0f5b69c 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -67,6 +67,6 @@ } ] } - MouseRegion { anchors.fill: wrapper; onClicked: { photoClicked() } } + MouseArea { anchors.fill: wrapper; onClicked: { photoClicked() } } } } diff --git a/demos/declarative/minehunt/Description.qml b/demos/declarative/minehunt/Description.qml index 440dd2e..cc4d3b2 100644 --- a/demos/declarative/minehunt/Description.qml +++ b/demos/declarative/minehunt/Description.qml @@ -4,7 +4,7 @@ Item { id: page height: myText.height + 20 property var text - MouseRegion { + MouseArea { anchors.fill: parent drag.target: page drag.axis: "XandYAxis" diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 18e8195..92555c2 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -101,7 +101,7 @@ Item { } } ] - MouseRegion { + MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: { @@ -188,7 +188,7 @@ Item { anchors.right: field.right anchors.rightMargin: 20 source: isPlaying ? 'pics/face-smile.png' : hasWon ? 'pics/face-smile-big.png': 'pics/face-sad.png' - MouseRegion { + MouseArea { anchors.fill: parent onPressed: { reset() } } diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/content/Button.qml index 63cd555..6629302 100644 --- a/demos/declarative/samegame/content/Button.qml +++ b/demos/declarative/samegame/content/Button.qml @@ -17,7 +17,7 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml index 5bd1123..7769328 100644 --- a/demos/declarative/samegame/content/Dialog.qml +++ b/demos/declarative/samegame/content/Dialog.qml @@ -18,5 +18,5 @@ Rectangle { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } - MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } + MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); } } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index f5c4fc5..50f6293 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -28,7 +28,7 @@ Rectangle { width: parent.width - (parent.width % getTileSize()); height: parent.height - (parent.height % getTileSize()); - MouseRegion { + MouseArea { id: gameMR anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); } diff --git a/demos/declarative/snake/content/Button.qml b/demos/declarative/snake/content/Button.qml index 63cd555..6629302 100644 --- a/demos/declarative/snake/content/Button.qml +++ b/demos/declarative/snake/content/Button.qml @@ -17,7 +17,7 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 58827a7..3bec747 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -101,7 +101,7 @@ Rectangle { id: skull } - MouseRegion { + MouseArea { anchors.fill: parent onPressed: { if (!head || !heartbeat.running) { diff --git a/demos/declarative/twitter/content/Button.qml b/demos/declarative/twitter/content/Button.qml index 09d471c..4cba8c3 100644 --- a/demos/declarative/twitter/content/Button.qml +++ b/demos/declarative/twitter/content/Button.qml @@ -19,7 +19,7 @@ Item { source: "images/toolbutton.sci" width: container.width; height: container.height } - MouseRegion { + MouseArea { id: mouseRegion anchors.fill: buttonImage onClicked: { container.clicked(); } diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml index b1c1938..19b6acc 100644 --- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml @@ -93,17 +93,17 @@ Item { } } - MouseRegion { + MouseArea { anchors.fill: cancelIcon onClicked: { reset() } } - MouseRegion { + MouseArea { anchors.fill: confirmIcon onClicked: { confirm() } } - MouseRegion { + MouseArea { id: editRegion anchors.fill: textEdit onClicked: { edit() } diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 8de13d5..934593c 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -103,7 +103,7 @@ Item { } } ] - MouseRegion { + MouseArea { anchors.fill: back_e onClicked: { if (webView.back.enabled) webView.back.trigger() } } @@ -114,7 +114,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } - MouseRegion { + MouseArea { anchors.fill: reload onClicked: { webView.reload.trigger() } } @@ -159,7 +159,7 @@ Item { } } ] - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { if (webView.forward.enabled) webView.forward.trigger() } } diff --git a/doc/src/declarative/advtutorial1.qdoc b/doc/src/declarative/advtutorial1.qdoc index 90bac1b..611a65d 100644 --- a/doc/src/declarative/advtutorial1.qdoc +++ b/doc/src/declarative/advtutorial1.qdoc @@ -56,7 +56,7 @@ button and room to display the score. The one thing you may not recognize here is the \l SystemPalette item. This item provides access to the Qt system palette and is used to make the button look more like a system button (for exact native feel you would use a \l QPushButton). Since we want a fully functional button, -we use the QML elements Text and MouseRegion inside a Rectangle to assemble a +we use the QML elements Text and MouseArea inside a Rectangle to assemble a button. Below is the code which we wrote to do this: \snippet declarative/tutorials/samegame/samegame1/Button.qml 0 diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index cfc100d..6f98cc1 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -110,7 +110,7 @@ PropertyAnimation { Image { id: image source: "image.png" - MouseRegion { + MouseArea { anchors.fill: parent onPressed: animation.start() } @@ -251,7 +251,7 @@ State { \o Update x from a script \qml -MouseRegion { +MouseArea { .... onClicked: redRect.x = 24; } diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 86485d0..a5c0d8c 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -294,7 +294,7 @@ Actions are used like this: \qml - MouseRegion { onClicked: MyItem.myaction.trigger() } + MouseArea { onClicked: MyItem.myaction.trigger() } State { name: "enabled"; when: MyItem.myaction.enabled == true } Text { text: MyItem.someaction.text } \endqml diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index e3323c2..826d483 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -126,7 +126,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \list -\o \l MouseRegion +\o \l MouseArea \o \l FocusScope \endlist diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc index c731d4a..faadfea 100644 --- a/doc/src/declarative/example-slideswitch.qdoc +++ b/doc/src/declarative/example-slideswitch.qdoc @@ -84,15 +84,15 @@ the text will only be visible when the switch is on. \snippet examples/declarative/slideswitch/content/Switch.qml 4 First, we create the background image of the switch. -In order for the switch to toggle when the user clicks on the background, we add a \l{MouseRegion} as a child item of the image. -A \c MouseRegion has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a +In order for the switch to toggle when the user clicks on the background, we add a \l{MouseArea} as a child item of the image. +A \c MouseArea has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a \c toggle() function. We will see what this function does in a moment. \snippet examples/declarative/slideswitch/content/Switch.qml 5 Then, we place the image of the knob on top of the background. The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag -property of the \c MouseRegion is for. We also want to toggle the switch if the knob is released between state. We handle this case +property of the \c MouseArea is for. We also want to toggle the switch if the knob is released between state. We handle this case in the \c dorelease() function that is called in the \c onReleased property. \section2 States diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index bb9e1a4..392837d 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -263,7 +263,7 @@ Rectangle { FocusScope { id: page; width: 240; height: 25 MyWidget { focus: true } - MouseRegion { anchors.fill: parent; onClicked: { page.focus = true } } + MouseArea { anchors.fill: parent; onClicked: { page.focus = true } } } \endcode \endtable diff --git a/doc/src/declarative/qmldebugging.qdoc b/doc/src/declarative/qmldebugging.qdoc index 97bc2f8..265dd0e 100644 --- a/doc/src/declarative/qmldebugging.qdoc +++ b/doc/src/declarative/qmldebugging.qdoc @@ -50,7 +50,7 @@ \qml Rectangle { width: 200; height: 200 - MouseRegion { + MouseArea { anchors.fill: parent onClicked: console.log("clicked") } diff --git a/doc/src/declarative/qmlintro.qdoc b/doc/src/declarative/qmlintro.qdoc index 0a503d7..6cb691a 100644 --- a/doc/src/declarative/qmlintro.qdoc +++ b/doc/src/declarative/qmlintro.qdoc @@ -326,11 +326,11 @@ Item { \section2 Signal Handlers Signal handlers allow actions to be taken in reponse to an event. For instance, -the \l MouseRegion element has signal handlers to handle mouse press, release +the \l MouseArea element has signal handlers to handle mouse press, release and click: \code -MouseRegion { +MouseArea { onPressed: console.log("mouse button pressed") } \endcode @@ -338,10 +338,10 @@ MouseRegion { All signal handlers begin with \e "on". Some signal handlers include an optional parameter, for example -the MouseRegion onPressed signal handler has a \e mouse parameter: +the MouseArea onPressed signal handler has a \e mouse parameter: \code -MouseRegion { +MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: if (mouse.button == Qt.RightButton) console.log("Right mouse button pressed") } diff --git a/doc/src/declarative/qmlstates.qdoc b/doc/src/declarative/qmlstates.qdoc index 867c714..a916ce8 100644 --- a/doc/src/declarative/qmlstates.qdoc +++ b/doc/src/declarative/qmlstates.qdoc @@ -94,7 +94,7 @@ Item { } ] - MouseRegion { + MouseArea { anchors.fill: parent onClicked: myItem.state = 'moved' } diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 8b9909e..0f1195c 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -212,7 +212,7 @@ Rectangle { text: "Hello Colorful World!" } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { palette.text = "blue"; @@ -255,7 +255,7 @@ the following types: \o QVariant \endlist -This example toggles the "LED Blinker" when the MouseRegion is clicked: +This example toggles the "LED Blinker" when the MouseArea is clicked: \table \row @@ -291,7 +291,7 @@ int main(int argc, char **argv) import Qt 4.6 Rectangle { - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { if (ledBlinker.isRunning()) @@ -315,7 +315,7 @@ is to have a "running" property. This leads to much nicer QML code: import Qt 4.6 Rectangle { - MouseRegion { + MouseArea { anchors.fill: parent onClicked: ledBlinker.running = !ledBlinker.running } diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc index 470e8f6..8716c77 100644 --- a/doc/src/declarative/scope.qdoc +++ b/doc/src/declarative/scope.qdoc @@ -317,7 +317,7 @@ Rectangle { anchors.centerIn: parent text: root.text } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: buttonClicked(text) } diff --git a/doc/src/declarative/tutorial2.qdoc b/doc/src/declarative/tutorial2.qdoc index 3e92e37..ee72ae8 100644 --- a/doc/src/declarative/tutorial2.qdoc +++ b/doc/src/declarative/tutorial2.qdoc @@ -87,10 +87,10 @@ In this case the rectangle will have the same size as its parent (see \l{anchor- \snippet examples/declarative/tutorials/helloworld/Cell.qml 3 -In order to change the color of the text when clicking on a cell, we create a \l MouseRegion element with +In order to change the color of the text when clicking on a cell, we create a \l MouseArea element with the same size as its parent. -A \l MouseRegion defines a signal called \e clicked. +A \l MouseArea defines a signal called \e clicked. When this signal is triggered we want to emit our own \e clicked signal with the color as parameter. \section2 The main QML file diff --git a/doc/src/declarative/tutorial3.qdoc b/doc/src/declarative/tutorial3.qdoc index e4d7995..bcf5f74 100644 --- a/doc/src/declarative/tutorial3.qdoc +++ b/doc/src/declarative/tutorial3.qdoc @@ -58,7 +58,7 @@ Here is the QML code: \snippet examples/declarative/tutorials/helloworld/tutorial3.qml 2 First, we create a new \e down state for our text element. -This state will be activated when the \l MouseRegion is pressed, and deactivated when it is released. +This state will be activated when the \l MouseArea is pressed, and deactivated when it is released. The \e down state includes a set of property changes from our implicit \e {default state} (the items as they were initially defined in the QML). diff --git a/doc/src/snippets/declarative/drag.qml b/doc/src/snippets/declarative/drag.qml index 8735d0c..8e5b599 100644 --- a/doc/src/snippets/declarative/drag.qml +++ b/doc/src/snippets/declarative/drag.qml @@ -6,7 +6,7 @@ Rectangle { Image { id: pic; source: "qtlogo-64.png"; anchors.verticalCenter: parent.verticalCenter opacity: (600.0-pic.x) / 600; - MouseRegion { + MouseArea { anchors.fill: parent drag.target: pic drag.axis: "XAxis" diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mouseregion.qml index 67857f5..79f8f8f 100644 --- a/doc/src/snippets/declarative/mouseregion.qml +++ b/doc/src/snippets/declarative/mouseregion.qml @@ -4,13 +4,13 @@ Rectangle { width: 200; height: 100 HorizontalLayout { //! [0] Rectangle { width: 100; height: 100; color: "green" - MouseRegion { anchors.fill: parent; onClicked: { parent.color = 'red' } } + MouseArea { anchors.fill: parent; onClicked: { parent.color = 'red' } } } //! [0] //! [1] Rectangle { width: 100; height: 100; color: "green" - MouseRegion { + MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { diff --git a/examples/declarative/anchors/anchor-changes.qml b/examples/declarative/anchors/anchor-changes.qml index f6fd35d..99ca3db 100644 --- a/examples/declarative/anchors/anchor-changes.qml +++ b/examples/declarative/anchors/anchor-changes.qml @@ -25,7 +25,7 @@ Item { Text { text: "Bottom"; anchors.bottom: parent.bottom } } - MouseRegion { + MouseArea { anchors.fill: content onPressed: window.state = "FullScreen" onReleased: window.state = "" diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml index 59e9b17..9b5bcc6 100644 --- a/examples/declarative/animations/easing.qml +++ b/examples/declarative/animations/easing.qml @@ -68,7 +68,7 @@ Rectangle { border.color: "White"; border.width: 2 height: 32; width: 32; radius: 8; anchors.verticalCenter: parent.verticalCenter - MouseRegion { + MouseArea { onClicked: if (rect.state == '') rect.state = "right"; else rect.state = '' anchors.fill: parent } diff --git a/examples/declarative/behaviours/MyRect.qml b/examples/declarative/behaviours/MyRect.qml index a272e1f..caf0d83 100644 --- a/examples/declarative/behaviours/MyRect.qml +++ b/examples/declarative/behaviours/MyRect.qml @@ -6,7 +6,7 @@ Rectangle { width: 100 height: 100 id: page - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { bluerect.parent = page; bluerect.x=0 } } diff --git a/examples/declarative/behaviours/SideRect.qml b/examples/declarative/behaviours/SideRect.qml index c7c7ebf..63b7db2 100644 --- a/examples/declarative/behaviours/SideRect.qml +++ b/examples/declarative/behaviours/SideRect.qml @@ -9,7 +9,7 @@ Rectangle { width: 75; height: 50 radius: 5 border.width: 10; border.color: "white"; - MouseRegion { + MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { focusRect.x = myRect.x; focusRect.y = myRect.y; focusRect.text = myRect.text } diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml index 1869c45..fc3f4bf 100644 --- a/examples/declarative/behaviours/test.qml +++ b/examples/declarative/behaviours/test.qml @@ -5,7 +5,7 @@ Rectangle { width: 800 height: 600 id: page - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { bluerect.parent = page; console.log(mouseX); bluerect.x = mouseX; } } diff --git a/examples/declarative/connections/content/Button.qml b/examples/declarative/connections/content/Button.qml index 1d46acc..0e33c78 100644 --- a/examples/declarative/connections/content/Button.qml +++ b/examples/declarative/connections/content/Button.qml @@ -8,5 +8,5 @@ Item { signal clicked Image { id: icon } - MouseRegion { anchors.fill: icon; onClicked: button.clicked() } + MouseArea { anchors.fill: icon; onClicked: button.clicked() } } diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml index c7b7659..3aed70e 100644 --- a/examples/declarative/dial/dial.qml +++ b/examples/declarative/dial/dial.qml @@ -26,7 +26,7 @@ Rectangle { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } - MouseRegion { + MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } diff --git a/examples/declarative/dynamic/qml/Button.qml b/examples/declarative/dynamic/qml/Button.qml index cf2ffa7..757e295 100644 --- a/examples/declarative/dynamic/qml/Button.qml +++ b/examples/declarative/dynamic/qml/Button.qml @@ -19,6 +19,6 @@ Rectangle { color: if(!mr.pressed){activePalette.button;}else{activePalette.dark;} } } - MouseRegion { id:mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id:mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text; color: activePalette.buttonText } } diff --git a/examples/declarative/dynamic/qml/PaletteItem.qml b/examples/declarative/dynamic/qml/PaletteItem.qml index bb6036d..8a9a9ee 100644 --- a/examples/declarative/dynamic/qml/PaletteItem.qml +++ b/examples/declarative/dynamic/qml/PaletteItem.qml @@ -4,7 +4,7 @@ GenericItem { id: itemButton property string file Script { source: "itemCreation.js" } - MouseRegion { + MouseArea { anchors.fill: parent; onPressed: startDrag(mouse); onPositionChanged: moveDrag(mouse); diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml index 51658ff..0674433 100644 --- a/examples/declarative/effects/effects.qml +++ b/examples/declarative/effects/effects.qml @@ -20,7 +20,7 @@ Rectangle { } } - MouseRegion { anchors.fill: parent; onClicked: blurEffect.running = !blurEffect.running } + MouseArea { anchors.fill: parent; onClicked: blurEffect.running = !blurEffect.running } } Text { text: "Blur"; anchors.top: blur.bottom; anchors.horizontalCenter: blur.horizontalCenter } @@ -36,7 +36,7 @@ Rectangle { offset.y: NumberAnimation { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; repeat: true; } } - MouseRegion { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running } + MouseArea { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running } } Image { diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml index 44d0c7b..0bdb9fc 100644 --- a/examples/declarative/layouts/Button.qml +++ b/examples/declarative/layouts/Button.qml @@ -7,7 +7,7 @@ Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.wid Image { id: pix; x: 5; y:5; source: parent.icon} Text { id: textelement; text: page.text; color: "white"; x:pix.width+pix.x+3; anchors.verticalCenter: pix.verticalCenter;} - MouseRegion{ id:mr; anchors.fill: parent; onClicked: {parent.focus = true; page.clicked()}} + MouseArea{ id:mr; anchors.fill: parent; onClicked: {parent.focus = true; page.clicked()}} states: State{ name:"pressed"; when:mr.pressed diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml index be37b50..0850f4e 100644 --- a/examples/declarative/listview/content/ClickAutoRepeating.qml +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -23,7 +23,7 @@ Item { PauseAnimation { duration: repeatperiod } } } - MouseRegion { + MouseArea { anchors.fill: parent onPressed: autoRepeat.start() onReleased: { autoRepeat.stop(); parent.isPressed = false; page.released() } diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index 1c88844..e9065c1 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -14,7 +14,7 @@ Item { source: "pics/button-pressed.png" opacity: 0 } - MouseRegion { + MouseArea { id: clickRegion anchors.fill: normal onClicked: { container.clicked(); } diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index dd898f9..81550d7 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -57,10 +57,10 @@ Rectangle { Column { id: moveButtons; x: 5; width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter Image { source: "content/pics/go-up.png" - MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) } + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) } } Image { source: "content/pics/go-down.png" - MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) } + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) } } } @@ -93,7 +93,7 @@ Rectangle { Image { id: removeButton; source: "content/pics/archive-remove.png" anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: 10 } - MouseRegion { anchors.fill:parent; onClicked: fruitModel.remove(index) } + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } } } } @@ -131,7 +131,7 @@ Rectangle { spacing: 8 id: buttons Image { source: "content/pics/archive-insert.png" - MouseRegion { anchors.fill: parent; + MouseArea { anchors.fill: parent; onClicked: { fruitModel.append({ "name":"Pizza Margarita", @@ -142,7 +142,7 @@ Rectangle { } } Image { source: "content/pics/archive-insert.png" - MouseRegion { anchors.fill: parent; + MouseArea { anchors.fill: parent; onClicked: { fruitModel.insert(0,{ "name":"Pizza Supreme", @@ -153,7 +153,7 @@ Rectangle { } } Image { source: "content/pics/archive-remove.png" - MouseRegion { anchors.fill: parent; onClicked: fruitModel.clear() } + MouseArea { anchors.fill: parent; onClicked: fruitModel.clear() } } } } diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml index 6392153..54981b7 100644 --- a/examples/declarative/listview/itemlist.qml +++ b/examples/declarative/listview/itemlist.qml @@ -51,7 +51,7 @@ Rectangle { Rectangle { width: 5; height: 5 radius: 3 - MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: view.currentIndex = index } + MouseArea { width: 20; height: 20; anchors.centerIn: parent; onClicked: view.currentIndex = index } color: view.currentIndex == index ? "blue" : "white" } } diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 3410f56..f848be0 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -32,7 +32,7 @@ Rectangle { // This mouse region covers the entire delegate. // When clicked it changes mode to 'Details'. If we are already // in Details mode, then no change will happen. - MouseRegion { + MouseArea { id: pageMouse anchors.fill: parent onClicked: wrapper.state = 'Details'; diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml index d07d471..9191f8a 100644 --- a/examples/declarative/mouseregion/mouse.qml +++ b/examples/declarative/mouseregion/mouse.qml @@ -7,7 +7,7 @@ Rectangle { width: 50; height: 50 color: "red" Text { text: "Click"; anchors.centerIn: parent } - MouseRegion { + MouseArea { hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: { console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') } @@ -24,7 +24,7 @@ Rectangle { y: 100; width: 50; height: 50 color: "blue" Text { text: "Drag"; anchors.centerIn: parent } - MouseRegion { + MouseArea { drag.target: parent drag.axis: "XAxis" drag.minimumX: 0 diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index f10d374..811891b 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -58,7 +58,7 @@ Item { transformOrigin: "Center" } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { root.currentIndex = index } } diff --git a/examples/declarative/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml index 7077a11..524b652 100644 --- a/examples/declarative/searchbox/SearchBox.qml +++ b/examples/declarative/searchbox/SearchBox.qml @@ -23,7 +23,7 @@ FocusScope { text: "Type something..."; color: "gray"; font.italic: true } - MouseRegion { anchors.fill: parent; onClicked: focusScope.focus = true } + MouseArea { anchors.fill: parent; onClicked: focusScope.focus = true } TextInput { id: textInput @@ -38,7 +38,7 @@ FocusScope { anchors.verticalCenter: parent.verticalCenter source: "images/edit-clear-locationbar-rtl.png"; opacity: 0 - MouseRegion { anchors.fill: parent; onClicked: { textInput.text = ''; focusScope.focus = true } } + MouseArea { anchors.fill: parent; onClicked: { textInput.text = ''; focusScope.focus = true } } } states: State { diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index c7f1c24..930f471 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -32,7 +32,7 @@ Item { //![4] Image { id: background; source: "background.svg" - MouseRegion { anchors.fill: parent; onClicked: toggle() } + MouseArea { anchors.fill: parent; onClicked: toggle() } } //![4] @@ -40,7 +40,7 @@ Item { Image { id: knob; source: "knob.svg"; x: 1; y: 2 - MouseRegion { + MouseArea { anchors.fill: parent drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78 onClicked: toggle() diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index 6f6b40f..89f2421 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -10,7 +10,7 @@ Rectangle { anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } width: 64; height: 64; radius: 6 color: "Transparent"; border.color: "Gray" - MouseRegion { anchors.fill: parent; onClicked: page.state = '' } + MouseArea { anchors.fill: parent; onClicked: page.state = '' } } // Another target region. Clicking in here sets the state to 'Position1' @@ -19,7 +19,7 @@ Rectangle { anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } width: 64; height: 64; radius: 6 color: "Transparent"; border.color: "Gray" - MouseRegion { anchors.fill: parent; onClicked: page.state = 'Position1' } + MouseArea { anchors.fill: parent; onClicked: page.state = 'Position1' } } // Another target region. Clicking in here sets the state to 'Position2' @@ -28,7 +28,7 @@ Rectangle { anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } width: 64; height: 64; radius: 6 color: "Transparent"; border.color: "Gray" - MouseRegion { anchors.fill: parent; onClicked: page.state = 'Position2' } + MouseArea { anchors.fill: parent; onClicked: page.state = 'Position2' } } // The image which will be moved when my state changes diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index ba97d9be..48d5f60 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -10,7 +10,7 @@ Rectangle { anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } width: 64; height: 64; radius: 6 color: "Transparent"; border.color: "Gray" - MouseRegion { anchors.fill: parent; onClicked: page.state = '' } + MouseArea { anchors.fill: parent; onClicked: page.state = '' } } // Another target region. Clicking in here sets the state to 'Position1' @@ -19,7 +19,7 @@ Rectangle { anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } width: 64; height: 64; radius: 6 color: "Transparent"; border.color: "Gray" - MouseRegion { anchors.fill: parent; onClicked: page.state = 'Position1' } + MouseArea { anchors.fill: parent; onClicked: page.state = 'Position1' } } // Another target region. Clicking in here sets the state to 'Position2' @@ -28,7 +28,7 @@ Rectangle { anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } width: 64; height: 64; radius: 6 color: "Transparent"; border.color: "Gray" - MouseRegion { anchors.fill: parent; onClicked: page.state = 'Position2' } + MouseArea { anchors.fill: parent; onClicked: page.state = 'Position2' } } // The image which will be moved when my state changes diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml index c56f41e..f0dfee8 100644 --- a/examples/declarative/tabwidget/TabWidget.qml +++ b/examples/declarative/tabwidget/TabWidget.qml @@ -25,7 +25,7 @@ Item { text: stack.children[index].title elide: Text.ElideRight } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: page.current = index } diff --git a/examples/declarative/tic-tac-toe/content/TicTac.qml b/examples/declarative/tic-tac-toe/content/TicTac.qml index eb80743..ccb7b78 100644 --- a/examples/declarative/tic-tac-toe/content/TicTac.qml +++ b/examples/declarative/tic-tac-toe/content/TicTac.qml @@ -13,7 +13,7 @@ Item { anchors.centerIn: parent } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.clicked() } diff --git a/examples/declarative/tutorials/helloworld/Cell.qml b/examples/declarative/tutorials/helloworld/Cell.qml index c38b40e..de4f3bb 100644 --- a/examples/declarative/tutorials/helloworld/Cell.qml +++ b/examples/declarative/tutorials/helloworld/Cell.qml @@ -23,7 +23,7 @@ Item { //![2] //![3] - MouseRegion { + MouseArea { anchors.fill: parent onClicked: container.clicked(container.color) } diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml index 107b066..9eaa009 100644 --- a/examples/declarative/tutorials/helloworld/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/tutorial3.qml @@ -14,7 +14,7 @@ Rectangle { transformOrigin: Item.Center //![1] - MouseRegion { id: mouseRegion; anchors.fill: parent } + MouseArea { id: mouseRegion; anchors.fill: parent } //![1] //![2] diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 85e6777..2e31ff8 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -18,7 +18,7 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml index 63cd555..6629302 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -17,7 +17,7 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/declarative/tutorials/samegame/samegame3/Button.qml index 63cd555..6629302 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Button.qml @@ -17,7 +17,7 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index 96dc246..9d35832 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -18,6 +18,6 @@ Rectangle { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } - MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } + MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); } } //![0] diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index 8bdb428..c616397 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -27,7 +27,7 @@ Rectangle { width: parent.width - (parent.width % tileSize); height: parent.height - (parent.height % tileSize); - MouseRegion { + MouseArea { id: gameMR anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml index 63cd555..6629302 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -17,7 +17,7 @@ Rectangle { GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index 3371d53..ed9fd32 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -17,5 +17,5 @@ Rectangle { NumberAnimation { duration: 1000 } } Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } - MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); } + MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); } } diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index 19b929f..a228e60 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -27,7 +27,7 @@ Rectangle { width: parent.width - (parent.width % getTileSize()); height: parent.height - (parent.height % getTileSize()); - MouseRegion { + MouseArea { id: gameMR anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y); } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 030fa13..c39f99b 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -48,7 +48,7 @@ Rectangle { x: stickyImage.x width: stickyImage.width * stickyImage.scale height: stickyImage.height * stickyImage.scale - MouseRegion { + MouseArea { id: mouse onClicked: { myText.focus = true } anchors.fill: parent diff --git a/examples/declarative/webview/content/FieldText.qml b/examples/declarative/webview/content/FieldText.qml index b1c1938..19b6acc 100644 --- a/examples/declarative/webview/content/FieldText.qml +++ b/examples/declarative/webview/content/FieldText.qml @@ -93,17 +93,17 @@ Item { } } - MouseRegion { + MouseArea { anchors.fill: cancelIcon onClicked: { reset() } } - MouseRegion { + MouseArea { anchors.fill: confirmIcon onClicked: { confirm() } } - MouseRegion { + MouseArea { id: editRegion anchors.fill: textEdit onClicked: { edit() } diff --git a/examples/declarative/webview/evalandattach.html b/examples/declarative/webview/evalandattach.html index c0992bb..48a1c33 100644 --- a/examples/declarative/webview/evalandattach.html +++ b/examples/declarative/webview/evalandattach.html @@ -1,7 +1,7 @@ <body bgcolor=gray onload="ftext.confirmed.connect (ftext_confirmed); "> <script> do_it = function () {var oPressed = document.getElementById('pressed'); - oPressed.innerHTML = 'MouseRegion in QML clicked!';}; + oPressed.innerHTML = 'MouseArea in QML clicked!';}; ftext_confirmed = function () { statusText1.text = ftext.text; var oT = document.getElementById('htmlTextInput'); oT.value = ftext.text } </script> <table border=1> diff --git a/examples/declarative/webview/evalandattach.qml b/examples/declarative/webview/evalandattach.qml index 1b211c9..94301cd 100644 --- a/examples/declarative/webview/evalandattach.qml +++ b/examples/declarative/webview/evalandattach.qml @@ -21,7 +21,7 @@ Item { anchors.right: parent.right } - MouseRegion { + MouseArea { anchors.fill: teksti onClicked: { webView.evaluateJavaScript ("do_it()") } } diff --git a/examples/declarative/workerscript/workerscript.qml b/examples/declarative/workerscript/workerscript.qml index e36d4d4..0566f1f 100644 --- a/examples/declarative/workerscript/workerscript.qml +++ b/examples/declarative/workerscript/workerscript.qml @@ -20,7 +20,7 @@ Rectangle { anchors.leftMargin: 20 color: "red" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: myWorker.sendMessage( { rectangle: "red", x: mouse.x, y: mouse.y } ); } @@ -32,7 +32,7 @@ Rectangle { anchors.rightMargin: 20 color: "blue" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: myWorker.sendMessage( { rectangle: "blue", x: mouse.x, y: mouse.y } ); } diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index 23463c2..b80e29c 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -22,7 +22,7 @@ Rectangle { id: delegate height: wrapper.height + 10 - MouseRegion { + MouseArea { anchors.fill: wrapper onPressed: delegate.ListView.view.currentIndex = index; onClicked: if (wrapper.state == 'Details') wrapper.state = ''; else wrapper.state = 'Details'; diff --git a/examples/declarative/xmlhttprequest/test.qml b/examples/declarative/xmlhttprequest/test.qml index 18e328b..15ac54b 100644 --- a/examples/declarative/xmlhttprequest/test.qml +++ b/examples/declarative/xmlhttprequest/test.qml @@ -3,7 +3,7 @@ import Qt 4.6 Rectangle { width: 800; height: 600 - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index e3aab65..a2afc1b 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,6 +1,8 @@ ============================================================================= The changes below are pre Qt 4.7.0 alpha +Renamed MouseRegion -> MouseArea + QmlView ------- The API of QmlView has been narrowed and its role as a convenience class diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index db9c29e..e5343c6 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -28,8 +28,8 @@ HEADERS += \ $$PWD/qmlgraphicspositioners_p_p.h \ $$PWD/qmlgraphicsloader_p.h \ $$PWD/qmlgraphicsloader_p_p.h \ - $$PWD/qmlgraphicsmouseregion_p.h \ - $$PWD/qmlgraphicsmouseregion_p_p.h \ + $$PWD/qmlgraphicsmousearea_p.h \ + $$PWD/qmlgraphicsmousearea_p_p.h \ $$PWD/qmlgraphicspath_p.h \ $$PWD/qmlgraphicspath_p_p.h \ $$PWD/qmlgraphicspathview_p.h \ @@ -70,7 +70,7 @@ SOURCES += \ $$PWD/qmlgraphicsfocusscope.cpp \ $$PWD/qmlgraphicspositioners.cpp \ $$PWD/qmlgraphicsloader.cpp \ - $$PWD/qmlgraphicsmouseregion.cpp \ + $$PWD/qmlgraphicsmousearea.cpp \ $$PWD/qmlgraphicspath.cpp \ $$PWD/qmlgraphicspathview.cpp \ $$PWD/qmlgraphicsrectangle.cpp \ diff --git a/src/declarative/graphicsitems/qmlgraphicsevents.cpp b/src/declarative/graphicsitems/qmlgraphicsevents.cpp index 1f63218..efd7b4a 100644 --- a/src/declarative/graphicsitems/qmlgraphicsevents.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsevents.cpp @@ -183,7 +183,7 @@ Item { For example, to react to a Shift key + Left mouse button click: \qml -MouseRegion { +MouseArea { onClicked: { if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) doSomething(); } } \endqml diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp index be512fc..f5abc18 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp @@ -97,7 +97,7 @@ public: NumberAnimation { properties: "angle"; duration: 2000 } } - MouseRegion { + MouseArea { // change between default and 'back' states onClicked: flipable.state = (flipable.state == 'back' ? '' : 'back') anchors.fill: parent diff --git a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp index 66d62f0..9263f49 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp @@ -51,7 +51,7 @@ #include "qmlgraphicsanimatedimage_p.h" #include "qmlgraphicsborderimage_p.h" #include "qmlgraphicspositioners_p.h" -#include "qmlgraphicsmouseregion_p.h" +#include "qmlgraphicsmousearea_p.h" #include "qmlgraphicsflickable_p.h" #include "qmlgraphicsflickable_p_p.h" #include "qmlgraphicsflipable_p.h" @@ -64,7 +64,7 @@ #include "qmlgraphicslayoutitem_p.h" #include "qmlgraphicslistview_p.h" #include "qmlgraphicsloader_p.h" -#include "qmlgraphicsmouseregion_p.h" +#include "qmlgraphicsmousearea_p.h" #include "qmlgraphicsparticles_p.h" #include "qmlgraphicspath_p.h" #include "qmlgraphicspathview_p.h" @@ -112,7 +112,8 @@ void QmlGraphicsItemModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,LayoutItem,QmlGraphicsLayoutItem); QML_REGISTER_TYPE(Qt,4,6,ListView,QmlGraphicsListView); QML_REGISTER_TYPE(Qt,4,6,Loader,QmlGraphicsLoader); - QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QmlGraphicsMouseRegion); + QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QmlGraphicsMouseArea); + QML_REGISTER_TYPE(Qt,4,6,MouseArea,QmlGraphicsMouseArea); QML_REGISTER_TYPE(Qt,4,6,Opacity,QGraphicsOpacityEffect); QML_REGISTER_TYPE(Qt,4,6,ParticleMotion,QmlGraphicsParticleMotion); QML_REGISTER_TYPE(Qt,4,6,ParticleMotionGravity,QmlGraphicsParticleMotionGravity); diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp index 159ddc3..e4c7411 100644 --- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp @@ -124,7 +124,7 @@ void QmlGraphicsLoaderPrivate::initResize() \code Loader { id: pageLoader } Rectangle { - MouseRegion { anchors.fill: parent; onClicked: pageLoader.source = "Page1.qml" } + MouseArea { anchors.fill: parent; onClicked: pageLoader.source = "Page1.qml" } } \endcode diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp b/src/declarative/graphicsitems/qmlgraphicsmousearea.cpp index 3470d37..cc07989 100644 --- a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsmousearea.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicsmouseregion_p.h" -#include "qmlgraphicsmouseregion_p_p.h" +#include "qmlgraphicsmousearea_p.h" +#include "qmlgraphicsmousearea_p_p.h" #include "qmlgraphicsevents_p_p.h" @@ -136,24 +136,24 @@ void QmlGraphicsDrag::setYmax(qreal m) emit maximumYChanged(); } -QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() +QmlGraphicsMouseAreaPrivate::~QmlGraphicsMouseAreaPrivate() { delete drag; } /*! - \qmlclass MouseRegion QmlGraphicsMouseRegion - \brief The MouseRegion item enables simple mouse handling. + \qmlclass MouseArea QmlGraphicsMouseArea + \brief The MouseArea item enables simple mouse handling. \inherits Item - A MouseRegion is typically used in conjunction with a visible item, - where the MouseRegion effectively 'proxies' mouse handling for that - item. For example, we can put a MouseRegion in a Rectangle that changes + A MouseArea is typically used in conjunction with a visible item, + where the MouseArea effectively 'proxies' mouse handling for that + item. For example, we can put a MouseArea in a Rectangle that changes the Rectangle color to red when clicked: \snippet doc/src/snippets/declarative/mouseregion.qml 0 - Many MouseRegion signals pass a \l {MouseEvent}{mouse} parameter that contains + Many MouseArea signals pass a \l {MouseEvent}{mouse} parameter that contains additional information about the mouse event, such as the position, button, and any key modifiers. @@ -163,13 +163,13 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() For basic key handling, see the \l {Keys}{Keys attached property}. - MouseRegion is an invisible item: it is never painted. + MouseArea is an invisible item: it is never painted. \sa MouseEvent */ /*! - \qmlsignal MouseRegion::onEntered() + \qmlsignal MouseArea::onEntered() This handler is called when the mouse enters the mouse region. @@ -181,7 +181,7 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() */ /*! - \qmlsignal MouseRegion::onExited() + \qmlsignal MouseArea::onExited() This handler is called when the mouse exists the mouse region. @@ -193,7 +193,7 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() */ /*! - \qmlsignal MouseRegion::onPositionChanged(MouseEvent mouse) + \qmlsignal MouseArea::onPositionChanged(MouseEvent mouse) This handler is called when the mouse position changes. @@ -208,10 +208,10 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() */ /*! - \qmlsignal MouseRegion::onClicked(mouse) + \qmlsignal MouseArea::onClicked(mouse) This handler is called when there is a click. A click is defined as a press followed by a release, - both inside the MouseRegion (pressing, moving outside the MouseRegion, and then moving back inside and + both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and releasing is also considered a click). The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y @@ -221,21 +221,21 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() */ /*! - \qmlsignal MouseRegion::onPressed(mouse) + \qmlsignal MouseArea::onPressed(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 position and which button was pressed. - The \e accepted property of the MouseEvent parameter determines whether this MouseRegion + The \e accepted property of the MouseEvent parameter determines whether this MouseArea will handle the press and all future mouse events until release. The default is to accept - the event and not allow other MouseRegions beneath this one to handle the event. If \e accepted - is set to false, no further events will be sent to this MouseRegion until the button is next + the event and not allow other MouseArea beneath this one to handle the event. If \e accepted + is set to false, no further events will be sent to this MouseArea until the button is next pressed. */ /*! - \qmlsignal MouseRegion::onReleased(mouse) + \qmlsignal MouseArea::onReleased(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 @@ -245,7 +245,7 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() */ /*! - \qmlsignal MouseRegion::onPressAndHold(mouse) + \qmlsignal MouseArea::onPressAndHold(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 @@ -255,7 +255,7 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() */ /*! - \qmlsignal MouseRegion::onDoubleClicked(mouse) + \qmlsignal MouseArea::onDoubleClicked(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 @@ -266,30 +266,30 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate() /*! \internal - \class QmlGraphicsMouseRegion - \brief The QmlGraphicsMouseRegion class provides a simple mouse handling abstraction for use within Qml. + \class QmlGraphicsMouseArea + \brief The QmlGraphicsMouseArea class provides a simple mouse handling abstraction for use within Qml. \ingroup group_coreitems - All QmlGraphicsItem derived classes can do mouse handling but the QmlGraphicsMouseRegion class exposes mouse + All QmlGraphicsItem derived classes can do mouse handling but the QmlGraphicsMouseArea class exposes mouse handling data as properties and tracks flicking and dragging of the mouse. - A QmlGraphicsMouseRegion object can be instantiated in Qml using the tag \l MouseRegion. + A QmlGraphicsMouseArea object can be instantiated in Qml using the tag \l MouseArea. */ -QmlGraphicsMouseRegion::QmlGraphicsMouseRegion(QmlGraphicsItem *parent) - : QmlGraphicsItem(*(new QmlGraphicsMouseRegionPrivate), parent) +QmlGraphicsMouseArea::QmlGraphicsMouseArea(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsMouseAreaPrivate), parent) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); d->init(); } -QmlGraphicsMouseRegion::~QmlGraphicsMouseRegion() +QmlGraphicsMouseArea::~QmlGraphicsMouseArea() { } /*! - \qmlproperty real MouseRegion::mouseX - \qmlproperty real MouseRegion::mouseY + \qmlproperty real MouseArea::mouseX + \qmlproperty real MouseArea::mouseY These properties hold the coordinates of the mouse. If the hoverEnabled property is false then these properties will only be valid @@ -298,44 +298,44 @@ QmlGraphicsMouseRegion::~QmlGraphicsMouseRegion() If hoverEnabled is true then these properties will be valid: \list - \i when no button is pressed, but the mouse is within the MouseRegion (containsMouse is true). + \i when no button is pressed, but the mouse is within the MouseArea (containsMouse is true). \i if a button is pressed and held, even if it has since moved out of the region. \endlist - The coordinates are relative to the MouseRegion. + The coordinates are relative to the MouseArea. */ -qreal QmlGraphicsMouseRegion::mouseX() const +qreal QmlGraphicsMouseArea::mouseX() const { - Q_D(const QmlGraphicsMouseRegion); + Q_D(const QmlGraphicsMouseArea); return d->lastPos.x(); } -qreal QmlGraphicsMouseRegion::mouseY() const +qreal QmlGraphicsMouseArea::mouseY() const { - Q_D(const QmlGraphicsMouseRegion); + Q_D(const QmlGraphicsMouseArea); return d->lastPos.y(); } /*! - \qmlproperty bool MouseRegion::enabled + \qmlproperty bool MouseArea::enabled This property holds whether the item accepts mouse events. */ -bool QmlGraphicsMouseRegion::isEnabled() const +bool QmlGraphicsMouseArea::isEnabled() const { - Q_D(const QmlGraphicsMouseRegion); + Q_D(const QmlGraphicsMouseArea); return d->absorb; } -void QmlGraphicsMouseRegion::setEnabled(bool a) +void QmlGraphicsMouseArea::setEnabled(bool a) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (a != d->absorb) { d->absorb = a; emit enabledChanged(); } } /*! - \qmlproperty MouseButtons MouseRegion::pressedButtons + \qmlproperty MouseButtons MouseArea::pressedButtons This property holds the mouse buttons currently pressed. It contains a bitwise combination of: @@ -351,7 +351,7 @@ void QmlGraphicsMouseRegion::setEnabled(bool a) text: mr.pressedButtons & Qt.RightButton ? "right" : "" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - MouseRegion { + MouseArea { id: mr acceptedButtons: Qt.LeftButton | Qt.RightButton anchors.fill: parent @@ -361,15 +361,15 @@ void QmlGraphicsMouseRegion::setEnabled(bool a) \sa acceptedButtons */ -Qt::MouseButtons QmlGraphicsMouseRegion::pressedButtons() const +Qt::MouseButtons QmlGraphicsMouseArea::pressedButtons() const { - Q_D(const QmlGraphicsMouseRegion); + Q_D(const QmlGraphicsMouseArea); return d->lastButtons; } -void QmlGraphicsMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); d->moved = false; if (!d->absorb) QmlGraphicsItem::mousePressEvent(event); @@ -392,9 +392,9 @@ void QmlGraphicsMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) } } -void QmlGraphicsMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->absorb) { QmlGraphicsItem::mouseMoveEvent(event); return; @@ -462,9 +462,9 @@ void QmlGraphicsMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } -void QmlGraphicsMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->absorb) { QmlGraphicsItem::mouseReleaseEvent(event); } else { @@ -477,9 +477,9 @@ void QmlGraphicsMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } } -void QmlGraphicsMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->absorb) { QmlGraphicsItem::mouseDoubleClickEvent(event); } else { @@ -493,18 +493,18 @@ void QmlGraphicsMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *eve } } -void QmlGraphicsMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +void QmlGraphicsMouseArea::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->absorb) QmlGraphicsItem::hoverEnterEvent(event); else setHovered(true); } -void QmlGraphicsMouseRegion::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +void QmlGraphicsMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->absorb) { QmlGraphicsItem::hoverEnterEvent(event); } else { @@ -514,20 +514,20 @@ void QmlGraphicsMouseRegion::hoverMoveEvent(QGraphicsSceneHoverEvent *event) } } -void QmlGraphicsMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +void QmlGraphicsMouseArea::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->absorb) QmlGraphicsItem::hoverLeaveEvent(event); else setHovered(false); } -bool QmlGraphicsMouseRegion::sceneEvent(QEvent *event) +bool QmlGraphicsMouseArea::sceneEvent(QEvent *event) { bool rv = QmlGraphicsItem::sceneEvent(event); if (event->type() == QEvent::UngrabMouse) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (d->pressed) { // if our mouse grab has been removed (probably by Flickable), fix our // state @@ -540,9 +540,9 @@ bool QmlGraphicsMouseRegion::sceneEvent(QEvent *event) return rv; } -void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event) +void QmlGraphicsMouseArea::timerEvent(QTimerEvent *event) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (event->timerId() == d->pressAndHoldTimer.timerId()) { d->pressAndHoldTimer.stop(); if (d->pressed && d->dragged == false && d->hovered == true) { @@ -554,7 +554,7 @@ void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event) } /*! - \qmlproperty bool MouseRegion::hoverEnabled + \qmlproperty bool 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 @@ -565,31 +565,31 @@ void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event) */ /*! - \qmlproperty bool MouseRegion::containsMouse + \qmlproperty bool MouseArea::containsMouse This property holds whether the mouse is currently inside the mouse region. \warning This property is not updated if the region moves under the mouse: \e containsMouse will not change. In addition, if hoverEnabled is false, containsMouse will only be valid when the mouse is pressed. */ -bool QmlGraphicsMouseRegion::hovered() const +bool QmlGraphicsMouseArea::hovered() const { - Q_D(const QmlGraphicsMouseRegion); + Q_D(const QmlGraphicsMouseArea); return d->hovered; } /*! - \qmlproperty bool MouseRegion::pressed + \qmlproperty bool MouseArea::pressed This property holds whether the mouse region is currently pressed. */ -bool QmlGraphicsMouseRegion::pressed() const +bool QmlGraphicsMouseArea::pressed() const { - Q_D(const QmlGraphicsMouseRegion); + Q_D(const QmlGraphicsMouseArea); return d->pressed; } -void QmlGraphicsMouseRegion::setHovered(bool h) +void QmlGraphicsMouseArea::setHovered(bool h) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (d->hovered != h) { d->hovered = h; emit hoveredChanged(); @@ -598,7 +598,7 @@ void QmlGraphicsMouseRegion::setHovered(bool h) } /*! - \qmlproperty Qt::MouseButtons MouseRegion::acceptedButtons + \qmlproperty Qt::MouseButtons MouseArea::acceptedButtons This property holds the mouse buttons that the mouse region reacts to. The available buttons are: @@ -612,17 +612,17 @@ void QmlGraphicsMouseRegion::setHovered(bool h) "|" (or) operator: \code - MouseRegion { acceptedButtons: Qt.LeftButton | Qt.RightButton } + MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton } \endcode The default is to accept the Left button. */ -Qt::MouseButtons QmlGraphicsMouseRegion::acceptedButtons() const +Qt::MouseButtons QmlGraphicsMouseArea::acceptedButtons() const { return acceptedMouseButtons(); } -void QmlGraphicsMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons) +void QmlGraphicsMouseArea::setAcceptedButtons(Qt::MouseButtons buttons) { if (buttons != acceptedMouseButtons()) { setAcceptedMouseButtons(buttons); @@ -630,9 +630,9 @@ void QmlGraphicsMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons) } } -bool QmlGraphicsMouseRegion::setPressed(bool p) +bool QmlGraphicsMouseArea::setPressed(bool p) { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); bool isclick = d->pressed == true && p == false && d->dragged == false && d->hovered == true; if (d->pressed != p) { @@ -653,21 +653,21 @@ bool QmlGraphicsMouseRegion::setPressed(bool p) return false; } -QmlGraphicsDrag *QmlGraphicsMouseRegion::drag() +QmlGraphicsDrag *QmlGraphicsMouseArea::drag() { - Q_D(QmlGraphicsMouseRegion); + Q_D(QmlGraphicsMouseArea); if (!d->drag) d->drag = new QmlGraphicsDrag; return d->drag; } /*! - \qmlproperty Item MouseRegion::drag.target - \qmlproperty Axis MouseRegion::drag.axis - \qmlproperty real MouseRegion::drag.minimumX - \qmlproperty real MouseRegion::drag.maximumX - \qmlproperty real MouseRegion::drag.minimumY - \qmlproperty real MouseRegion::drag.maximumY + \qmlproperty Item MouseArea::drag.target + \qmlproperty Axis MouseArea::drag.axis + \qmlproperty real MouseArea::drag.minimumX + \qmlproperty real MouseArea::drag.maximumX + \qmlproperty real MouseArea::drag.minimumY + \qmlproperty real MouseArea::drag.maximumY drag provides a convenient way to make an item draggable. diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h b/src/declarative/graphicsitems/qmlgraphicsmousearea_p.h index cccf90c..2e2f8c9 100644 --- a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsmousearea_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSMOUSEREGION_H -#define QMLGRAPHICSMOUSEREGION_H +#ifndef QMLGRAPHICSMOUSEAREA_H +#define QMLGRAPHICSMOUSEAREA_H #include "qmlgraphicsitem.h" @@ -102,8 +102,8 @@ private: }; class QmlGraphicsMouseEvent; -class QmlGraphicsMouseRegionPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem +class QmlGraphicsMouseAreaPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsMouseArea : public QmlGraphicsItem { Q_OBJECT @@ -118,8 +118,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem Q_PROPERTY(QmlGraphicsDrag *drag READ drag CONSTANT) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ??? public: - QmlGraphicsMouseRegion(QmlGraphicsItem *parent=0); - ~QmlGraphicsMouseRegion(); + QmlGraphicsMouseArea(QmlGraphicsItem *parent=0); + ~QmlGraphicsMouseArea(); qreal mouseX() const; qreal mouseY() const; @@ -171,15 +171,15 @@ private: void handleRelease(); private: - Q_DISABLE_COPY(QmlGraphicsMouseRegion) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseRegion) + Q_DISABLE_COPY(QmlGraphicsMouseArea) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseArea) }; QT_END_NAMESPACE QML_DECLARE_TYPE(QmlGraphicsDrag) -QML_DECLARE_TYPE(QmlGraphicsMouseRegion) +QML_DECLARE_TYPE(QmlGraphicsMouseArea) QT_END_HEADER -#endif // QMLGRAPHICSMOUSEREGION_H +#endif // QMLGRAPHICSMOUSEAREA_H diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p_p.h b/src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h index be27176..fadb430 100644 --- a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h @@ -61,21 +61,21 @@ QT_BEGIN_NAMESPACE -class QmlGraphicsMouseRegionPrivate : public QmlGraphicsItemPrivate +class QmlGraphicsMouseAreaPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QmlGraphicsMouseRegion) + Q_DECLARE_PUBLIC(QmlGraphicsMouseArea) public: - QmlGraphicsMouseRegionPrivate() + QmlGraphicsMouseAreaPrivate() : absorb(true), hovered(false), pressed(false), longPress(false), drag(0) { } - ~QmlGraphicsMouseRegionPrivate(); + ~QmlGraphicsMouseAreaPrivate(); void init() { - Q_Q(QmlGraphicsMouseRegion); + Q_Q(QmlGraphicsMouseArea); q->setAcceptedMouseButtons(Qt::LeftButton); } @@ -87,7 +87,7 @@ public: } bool isConnected(const char *signal) { - Q_Q(QmlGraphicsMouseRegion); + Q_Q(QmlGraphicsMouseArea); int idx = QObjectPrivate::get(q)->signalIndex(signal); return QObjectPrivate::get(q)->isSignalConnected(idx); } diff --git a/src/declarative/qml/qmlscript.cpp b/src/declarative/qml/qmlscript.cpp index c0320cd..ef142a5 100644 --- a/src/declarative/qml/qmlscript.cpp +++ b/src/declarative/qml/qmlscript.cpp @@ -58,7 +58,7 @@ console.log(otherinterestingitem.property); } } - MouseRegion { onClicked: debugMyComponent() } + MouseArea { onClicked: debugMyComponent() } \endqml \note While it is possible to use any JavaScript code within a Script element, diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 82bd33e..d7ddfce 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -176,7 +176,7 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj The \c running property can be set to declaratively control whether or not an animation is running. The following example will animate a rectangle - whenever the \l MouseRegion is pressed. + whenever the \l MouseArea is pressed. \code Rectangle { @@ -185,7 +185,7 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj running: myMouse.pressed from: 0; to: 100 } - MouseRegion { id: myMouse } + MouseArea { id: myMouse } } \endcode @@ -1794,7 +1794,7 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type) Fade out \c theObject when clicked: \qml - MouseRegion { + MouseArea { anchors.fill: theObject onClicked: PropertyAnimation { target: theObject; property: "opacity"; to: 0 } } @@ -2214,7 +2214,7 @@ void QmlPropertyAnimation::setProperties(const QString &prop) color: Qt.rgba(0,0,1) //need to explicitly specify target and property NumberAnimation { id: theAnim; target: theRect; property: "x" to: 500 } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: theAnim.start() } diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index 9bec3bb..3d04aaf 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -72,7 +72,7 @@ public: "on<Signal>" handler that reacts when a signal is received, like this: \qml - MouseRegion { + MouseArea { onClicked: { foo(x+123,y+456) } } \endqml @@ -94,7 +94,7 @@ public: like this: \qml - MouseRegion { + MouseArea { Connection { signal: "clicked(x,y)" script: { foo(x+123,y+456) } @@ -106,7 +106,7 @@ public: the sender of the signal, and the script is the default attribute: \qml - MouseRegion { + MouseArea { id: mr } ... diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index af41dfd..8fda3ae 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -188,7 +188,7 @@ static void dump(ModelNode *node, int ind); Text { text: '$'+cost; anchors.right: parent.right } // Double the price when clicked. - MouseRegion { + MouseArea { anchors.fill: parent onClicked: fruitModel.set(index, "cost", cost*2) } diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 84f1e9a..068cb4d 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE } } - MouseRegion { anchors.fill: parent; onClicked: myText.state = 'myState' } + MouseArea { anchors.fill: parent; onClicked: myText.state = 'myState' } } \endqml @@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE \qml PropertyChanges { - target: myMouseRegion + target: myMouseArea onClicked: doSomethingDifferent() } \endqml diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index b4a0d0f..2c58f7c 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -29,7 +29,7 @@ SUBDIRS += \ qmlgraphicsitem \ # Cover qmlgraphicslistview \ # Cover qmlgraphicsloader \ # Cover - qmlgraphicsmouseregion \ # Cover + qmlgraphicsmousearea \ # Cover qmlgraphicsparticles \ # Cover qmlgraphicspathview \ # Cover qmlgraphicspositioners \ # Cover diff --git a/tests/auto/declarative/qmlanimations/data/badtype4.qml b/tests/auto/declarative/qmlanimations/data/badtype4.qml index 2ffed37..e80762f 100644 --- a/tests/auto/declarative/qmlanimations/data/badtype4.qml +++ b/tests/auto/declarative/qmlanimations/data/badtype4.qml @@ -10,7 +10,7 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - MouseRegion { + MouseArea { anchors.fill: parent onClicked: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1"; } diff --git a/tests/auto/declarative/qmlanimations/data/dotproperty.qml b/tests/auto/declarative/qmlanimations/data/dotproperty.qml index 08bb5d8..9f0e699 100644 --- a/tests/auto/declarative/qmlanimations/data/dotproperty.qml +++ b/tests/auto/declarative/qmlanimations/data/dotproperty.qml @@ -9,7 +9,7 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - MouseRegion { + MouseArea { anchors.fill: parent onClicked: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1"; } diff --git a/tests/auto/declarative/qmlanimations/data/mixedtype1.qml b/tests/auto/declarative/qmlanimations/data/mixedtype1.qml index b46270c..6770366 100644 --- a/tests/auto/declarative/qmlanimations/data/mixedtype1.qml +++ b/tests/auto/declarative/qmlanimations/data/mixedtype1.qml @@ -10,7 +10,7 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - MouseRegion { + MouseArea { anchors.fill: parent onClicked: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1"; } diff --git a/tests/auto/declarative/qmlanimations/data/mixedtype2.qml b/tests/auto/declarative/qmlanimations/data/mixedtype2.qml index 15537f1..80c9473 100644 --- a/tests/auto/declarative/qmlanimations/data/mixedtype2.qml +++ b/tests/auto/declarative/qmlanimations/data/mixedtype2.qml @@ -10,7 +10,7 @@ Rectangle { color: "red" width: 50; height: 50 x: 100; y: 100 - MouseRegion { + MouseArea { anchors.fill: parent onClicked: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1"; } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml index 2f7fd4a..b13b94b 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml @@ -22,7 +22,7 @@ Rectangle { NumberAnimation { targets: theRect; properties: "x" } } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "moved" } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml index ae59157..033c5c1 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml @@ -22,7 +22,7 @@ Rectangle { NumberAnimation { target: theRect; property: "y"; to: 200 } } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "moved" } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml index 5aaaab8..d0704c9 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml @@ -22,7 +22,7 @@ Rectangle { NumberAnimation { targets: theRect; properties: "y" } } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "moved" } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml index b7ebb1b..e70c95c 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml @@ -22,7 +22,7 @@ Rectangle { NumberAnimation { target: theRect; properties: "x" } } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "moved" } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml index 9034fc5..b9e27da 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml @@ -22,7 +22,7 @@ Rectangle { NumberAnimation { targets: theRect; property: "x" } } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "moved" } diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml b/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml index 3d8be51..7417ed1 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml +++ b/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml @@ -22,7 +22,7 @@ Rectangle { NumberAnimation { targets: theItem; properties: "x" } } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "moved" } diff --git a/tests/auto/declarative/qmlbehaviors/data/binding.qml b/tests/auto/declarative/qmlbehaviors/data/binding.qml index 18d6764..201da37 100644 --- a/tests/auto/declarative/qmlbehaviors/data/binding.qml +++ b/tests/auto/declarative/qmlbehaviors/data/binding.qml @@ -11,7 +11,7 @@ Rectangle { x: basex x: Behavior { NumberAnimation { duration: 500; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/color.qml b/tests/auto/declarative/qmlbehaviors/data/color.qml index aac7283..91dbbd1 100644 --- a/tests/auto/declarative/qmlbehaviors/data/color.qml +++ b/tests/auto/declarative/qmlbehaviors/data/color.qml @@ -9,7 +9,7 @@ Rectangle { color: "green" color: Behavior { ColorAnimation { duration: 500; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/disabled.qml b/tests/auto/declarative/qmlbehaviors/data/disabled.qml index e7b8d51..3c7078a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/disabled.qml +++ b/tests/auto/declarative/qmlbehaviors/data/disabled.qml @@ -12,7 +12,7 @@ Rectangle { NumberAnimation { duration: 200; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/empty.qml b/tests/auto/declarative/qmlbehaviors/data/empty.qml index 412e26c..95d934a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/empty.qml +++ b/tests/auto/declarative/qmlbehaviors/data/empty.qml @@ -8,7 +8,7 @@ Rectangle { width: 100; height: 100; color: "green" x: Behavior {} } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/explicit.qml b/tests/auto/declarative/qmlbehaviors/data/explicit.qml index bb17076..1b2025a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/explicit.qml +++ b/tests/auto/declarative/qmlbehaviors/data/explicit.qml @@ -11,7 +11,7 @@ Rectangle { NumberAnimation { target: rect; property: "x"; duration: 500; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/groupProperty.qml b/tests/auto/declarative/qmlbehaviors/data/groupProperty.qml index 8a734c1..14883d4 100644 --- a/tests/auto/declarative/qmlbehaviors/data/groupProperty.qml +++ b/tests/auto/declarative/qmlbehaviors/data/groupProperty.qml @@ -8,7 +8,7 @@ Rectangle { width: 100; height: 100; color: "green" pos: Behavior { PropertyAnimation { duration: 500; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml b/tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml index 602ffbb..b43ddbc 100644 --- a/tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml +++ b/tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml @@ -8,7 +8,7 @@ Rectangle { width: 100; height: 100; color: "green" pos.x: Behavior { NumberAnimation { duration: 500; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml index 59cbd1a..f267a05 100644 --- a/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml +++ b/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml @@ -11,7 +11,7 @@ Rectangle { NumberAnimation { targets: rect; properties: "y"; duration: 200; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml index 693a595..ba744b1 100644 --- a/tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml @@ -12,7 +12,7 @@ Rectangle { NumberAnimation { duration: 1000 } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmlbehaviors/data/simple.qml b/tests/auto/declarative/qmlbehaviors/data/simple.qml index c08a1f0..ac98ed0 100644 --- a/tests/auto/declarative/qmlbehaviors/data/simple.qml +++ b/tests/auto/declarative/qmlbehaviors/data/simple.qml @@ -11,7 +11,7 @@ Rectangle { NumberAnimation { duration: 500; } } } - MouseRegion { + MouseArea { id: clicker anchors.fill: parent } diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp index 2e668ad..ba07331 100644 --- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp +++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp @@ -825,7 +825,7 @@ int main(int argc, char *argv[]) "width: 10; height: 20; scale: blueRect.scale;" "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" "Text { color: blueRect.color; }" - "MouseRegion {" + "MouseArea {" "onEntered: { console.log('hello') }" "}" "}"; diff --git a/tests/auto/declarative/qmlgraphicsmouseregion/data/dragproperties.qml b/tests/auto/declarative/qmlgraphicsmousearea/data/dragproperties.qml index 5acb3e4..4cd78da 100644 --- a/tests/auto/declarative/qmlgraphicsmouseregion/data/dragproperties.qml +++ b/tests/auto/declarative/qmlgraphicsmousearea/data/dragproperties.qml @@ -14,7 +14,7 @@ Rectangle { height: 100 opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200 Text { text: blackRect.opacity} - MouseRegion { + MouseArea { objectName: "mouseregion" anchors.fill: parent drag.target: blackRect @@ -25,4 +25,4 @@ Rectangle { drag.maximumY: whiteRect.height-blackRect.height } } - }
\ No newline at end of file + } diff --git a/tests/auto/declarative/qmlgraphicsmouseregion/qmlgraphicsmouseregion.pro b/tests/auto/declarative/qmlgraphicsmousearea/qmlgraphicsmousearea.pro index 7a7c8bd..f85bf0f 100644 --- a/tests/auto/declarative/qmlgraphicsmouseregion/qmlgraphicsmouseregion.pro +++ b/tests/auto/declarative/qmlgraphicsmousearea/qmlgraphicsmousearea.pro @@ -3,7 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative gui network macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h -SOURCES += tst_qmlgraphicsmouseregion.cpp ../shared/testhttpserver.cpp +SOURCES += tst_qmlgraphicsmousearea.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp index 82da9c8..869a7bd 100644 --- a/tests/auto/declarative/qmlgraphicsmouseregion/tst_qmlgraphicsmouseregion.cpp +++ b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp @@ -41,10 +41,10 @@ #include <QtTest/QtTest> #include <QtTest/QSignalSpy> -#include <private/qmlgraphicsmouseregion_p.h> +#include <private/qmlgraphicsmousearea_p.h> #include <QtDeclarative/qmlview.h> -class tst_QmlGraphicsMouseRegion: public QObject +class tst_QmlGraphicsMouseArea: public QObject { Q_OBJECT private slots: @@ -53,7 +53,7 @@ private: QmlView *createView(const QString &filename); }; -void tst_QmlGraphicsMouseRegion::dragProperties() +void tst_QmlGraphicsMouseArea::dragProperties() { QmlView *canvas = createView(SRCDIR "/data/dragproperties.qml"); canvas->execute(); @@ -61,7 +61,7 @@ void tst_QmlGraphicsMouseRegion::dragProperties() canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); - QmlGraphicsMouseRegion *mouseRegion = canvas->rootObject()->findChild<QmlGraphicsMouseRegion*>("mouseregion"); + QmlGraphicsMouseArea *mouseRegion = canvas->rootObject()->findChild<QmlGraphicsMouseArea*>("mouseregion"); QmlGraphicsDrag *drag = mouseRegion->drag(); QVERIFY(mouseRegion != 0); QVERIFY(drag != 0); @@ -124,7 +124,7 @@ void tst_QmlGraphicsMouseRegion::dragProperties() QCOMPARE(ymaxSpy.count(),1); } -QmlView *tst_QmlGraphicsMouseRegion::createView(const QString &filename) +QmlView *tst_QmlGraphicsMouseArea::createView(const QString &filename) { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); @@ -134,6 +134,6 @@ QmlView *tst_QmlGraphicsMouseRegion::createView(const QString &filename) return canvas; } -QTEST_MAIN(tst_QmlGraphicsMouseRegion) +QTEST_MAIN(tst_QmlGraphicsMouseArea) -#include "tst_qmlgraphicsmouseregion.moc" +#include "tst_qmlgraphicsmousearea.moc" diff --git a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml b/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml index 779c6d4..32b5b6c 100644 --- a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml +++ b/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml @@ -23,7 +23,7 @@ Item { width: 200; height: 50 Text { text: name } Text { text: '$'+cost; anchors.right: parent.right } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: fruitModel.remove(index) } diff --git a/tests/auto/declarative/qmlstates/data/illegalTempState.qml b/tests/auto/declarative/qmlstates/data/illegalTempState.qml index 2702be4..0dc39ae 100644 --- a/tests/auto/declarative/qmlstates/data/illegalTempState.qml +++ b/tests/auto/declarative/qmlstates/data/illegalTempState.qml @@ -14,7 +14,7 @@ Rectangle { } ] - MouseRegion { + MouseArea { anchors.fill: parent onClicked: card.state = "placed" } diff --git a/tests/auto/declarative/qmlstates/data/legalTempState.qml b/tests/auto/declarative/qmlstates/data/legalTempState.qml index 54c97b9..9be984c 100644 --- a/tests/auto/declarative/qmlstates/data/legalTempState.qml +++ b/tests/auto/declarative/qmlstates/data/legalTempState.qml @@ -16,7 +16,7 @@ Rectangle { } ] - MouseRegion { + MouseArea { anchors.fill: parent onClicked: card.state = "placed" } diff --git a/tests/auto/declarative/qmlstates/data/parentChange.qml b/tests/auto/declarative/qmlstates/data/parentChange.qml index 087da6b..b8c7818 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange.qml +++ b/tests/auto/declarative/qmlstates/data/parentChange.qml @@ -12,7 +12,7 @@ Rectangle { color: "red" } } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/qmlstates/data/parentChange2.qml b/tests/auto/declarative/qmlstates/data/parentChange2.qml index f0b00f5..8b23591 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange2.qml +++ b/tests/auto/declarative/qmlstates/data/parentChange2.qml @@ -15,7 +15,7 @@ Rectangle { color: "red" } } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/qmlstates/data/parentChange3.qml b/tests/auto/declarative/qmlstates/data/parentChange3.qml index 2aa507c..ddf9268 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange3.qml +++ b/tests/auto/declarative/qmlstates/data/parentChange3.qml @@ -16,7 +16,7 @@ Rectangle { color: "red" } } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/qmlstates/data/parentChange4.qml b/tests/auto/declarative/qmlstates/data/parentChange4.qml index d00274b..34d667a 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange4.qml +++ b/tests/auto/declarative/qmlstates/data/parentChange4.qml @@ -9,7 +9,7 @@ Rectangle { width: 100; height: 100 color: "red" } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/qmlstates/data/parentChange5.qml b/tests/auto/declarative/qmlstates/data/parentChange5.qml index f75e2a3..56bdd89 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange5.qml +++ b/tests/auto/declarative/qmlstates/data/parentChange5.qml @@ -9,7 +9,7 @@ Rectangle { width: 100; height: 100 color: "red" } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml index dcfe7de..b577e45 100644 --- a/tests/auto/declarative/visual/Package_Views/packageviews.qml +++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml @@ -29,14 +29,14 @@ Rectangle { delegate: Package { Rectangle { id: listItem; Package.name: "list"; width:root.width/2; height: 50; color: "transparent"; border.color: "white" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: myState.state = myState.state == "list" ? "grid" : "list" } } Rectangle { id: gridItem; Package.name: "grid"; width:50; height: 50; color: "transparent"; border.color: "white" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: myState.state = myState.state == "list" ? "grid" : "list" } diff --git a/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml index 5230ca4..70c14cf 100644 --- a/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml +++ b/tests/auto/declarative/visual/animation/bindinganimation/bindinganimation.qml @@ -20,7 +20,7 @@ Rectangle { x: 50 + 50 } PropertyChanges { - target: myMouseRegion + target: myMouseArea onClicked: page.state = '' } } @@ -32,8 +32,8 @@ Rectangle { } } ] - MouseRegion { - id: myMouseRegion + MouseArea { + id: myMouseArea anchors.fill: parent onClicked: { page.state= 'hello' } } diff --git a/tests/auto/declarative/visual/animation/colorAnimation/colorAnimation.qml b/tests/auto/declarative/visual/animation/colorAnimation/colorAnimation.qml index 0e98d7e..f205ae8 100644 --- a/tests/auto/declarative/visual/animation/colorAnimation/colorAnimation.qml +++ b/tests/auto/declarative/visual/animation/colorAnimation/colorAnimation.qml @@ -34,7 +34,7 @@ Rectangle { } } ] - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { mainrect.state = 'second' } } diff --git a/tests/auto/declarative/visual/animation/easing/easing.qml b/tests/auto/declarative/visual/animation/easing/easing.qml index f81400b..9c814eb 100644 --- a/tests/auto/declarative/visual/animation/easing/easing.qml +++ b/tests/auto/declarative/visual/animation/easing/easing.qml @@ -186,7 +186,7 @@ Rectangle { } } } - MouseRegion { + MouseArea { id: mouse anchors.fill: layout } diff --git a/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml b/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml index 7021e05..1980b91 100644 --- a/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml +++ b/tests/auto/declarative/visual/animation/parallelAnimation/parallelAnimation.qml @@ -14,7 +14,7 @@ Rectangle { color: "red" } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: parent.state = "state1" } diff --git a/tests/auto/declarative/visual/animation/parentAction/parentAction.qml b/tests/auto/declarative/visual/animation/parentAction/parentAction.qml index e4f4406..eb3103e 100644 --- a/tests/auto/declarative/visual/animation/parentAction/parentAction.qml +++ b/tests/auto/declarative/visual/animation/parentAction/parentAction.qml @@ -15,7 +15,7 @@ Rectangle { color: "red" } } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml index 68671e1..593f495 100644 --- a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml +++ b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml @@ -7,7 +7,7 @@ Rectangle { width: 100; height: 100 color: "red" } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml index 359346f..d80631f 100644 --- a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml +++ b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml @@ -19,7 +19,7 @@ Rectangle { Item { id: topGuideline2; y: 50 } Item { id: bottomGuideline2; y: 175 } - MouseRegion { + MouseArea { id: wholeArea anchors.fill: parent onClicked: { @@ -55,7 +55,7 @@ Rectangle { NumberAnimation { properties: "x,y,width,height" } } - MouseRegion { + MouseArea { width: 50; height: 50 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml index f121906..30d587a 100644 --- a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml +++ b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml @@ -7,7 +7,7 @@ Rectangle { width: 100; height: 100 color: "red" } - MouseRegion { + MouseArea { id: clickable anchors.fill: parent } diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml b/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml index cc15755..6204aa9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml +++ b/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml @@ -25,7 +25,7 @@ Rectangle { Repeater { model: list Rectangle { width: 300; height: 200; color: mr.pressed ? "black" : dayColor - MouseRegion { + MouseArea { id: mr anchors.fill: parent } @@ -49,7 +49,7 @@ Rectangle { height: 48 y: parent.height - 50 color: "red" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: flick.interactive = flick.interactive ? false : true } @@ -62,7 +62,7 @@ Rectangle { x: 66 y: parent.height - 50 color: "green" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: flick.pressDelay = flick.pressDelay > 0 ? 0 : 500 } @@ -75,7 +75,7 @@ Rectangle { x: 130 y: parent.height - 50 color: "yellow" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: flick.overShoot = flick.overShoot > 0 ? 0 : 30 } diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml b/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml index 70018b6..0adfa02 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml +++ b/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml @@ -22,7 +22,7 @@ Rectangle { width: 85; height: 85; color: lColor scale: wrapper.PathView.scale - MouseRegion { anchors.fill: parent } + MouseArea { anchors.fill: parent } transform: Rotation { id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 diff --git a/tests/auto/declarative/visual/qmlmouseregion/drag.qml b/tests/auto/declarative/visual/qmlmouseregion/drag.qml index ab4c280..dbb2a24 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/drag.qml +++ b/tests/auto/declarative/visual/qmlmouseregion/drag.qml @@ -8,7 +8,7 @@ Rectangle{ id: draggable width:40; height:40; color: "lightsteelblue" y:20 - MouseRegion{ + MouseArea{ anchors.fill: parent drag.target: draggable drag.axis: "XandYAxis" diff --git a/tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml b/tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml index ab4223d..3c722d0 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml +++ b/tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml @@ -9,7 +9,7 @@ Rectangle { Rectangle { width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr1 anchors.fill: parent enabled: false @@ -22,7 +22,7 @@ Rectangle { x: 100 width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr2 anchors.fill: parent acceptedButtons: Qt.RightButton @@ -42,7 +42,7 @@ Rectangle { x: 200 width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr3 anchors.fill: parent onPressAndHold: { @@ -56,7 +56,7 @@ Rectangle { x: 300 width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr4 anchors.fill: parent onPressed: { @@ -74,7 +74,7 @@ Rectangle { y: 50 width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr5 anchors.fill: parent hoverEnabled: true @@ -93,7 +93,7 @@ Rectangle { y: 50 width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr6 anchors.fill: parent onClicked: { @@ -111,7 +111,7 @@ Rectangle { y: 50 width: 98; height: 48 color: "red" - MouseRegion { + MouseArea { id: mr7 anchors.fill: parent enabled: false diff --git a/tests/auto/declarative/visual/qmlspringfollow/follow.qml b/tests/auto/declarative/visual/qmlspringfollow/follow.qml index 8a713a2..a85a778 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/follow.qml +++ b/tests/auto/declarative/visual/qmlspringfollow/follow.qml @@ -44,7 +44,7 @@ Rectangle { } // Follow mouse - MouseRegion { + MouseArea { id: mouseRegion anchors.fill: parent Rectangle { diff --git a/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml b/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml index 21a19bc..da7f9b6 100644 --- a/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml +++ b/tests/auto/declarative/visual/selftest_noimages/selftest_noimages.qml @@ -2,7 +2,7 @@ import Qt 4.6 Text { property string error: "not pressed" text: (new Date()).valueOf() - MouseRegion { + MouseArea { anchors.fill: parent onPressed: error="" } diff --git a/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml b/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml index 2478932..72e672d 100644 --- a/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml +++ b/tests/auto/declarative/visual/webview/settings/noAutoLoadImages.qml @@ -11,7 +11,7 @@ Grid { anchors.fill: parent settings.autoLoadImages: false url: "test-img.html" - MouseRegion { + MouseArea { anchors.fill: parent onClicked: { parent.settings.autoLoadImages=true; label.text=""; parent.reload.trigger() } } diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml index 210c515..996602c 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml @@ -24,7 +24,7 @@ Item { Text { }, Text { }, Text { }, - MouseRegion { } + MouseArea { } ] } diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml index 943634f..9f79c34 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml @@ -24,7 +24,7 @@ Item { Text { }, Text { }, Text { }, - MouseRegion { } + MouseArea { } ] } diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml index ce986b5..335aeb8 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml @@ -24,7 +24,7 @@ Item { Text { }, Text { }, Text { }, - MouseRegion { } + MouseArea { } ] } diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml index 25e9c62..97bad47 100644 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml +++ b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml @@ -30,7 +30,7 @@ Item { Text { } } } - MouseRegion { } + MouseArea { } } } } diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml index ee3f9d1..36dda15 100644 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml +++ b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml @@ -27,7 +27,7 @@ Item { Text { } Text { } } - MouseRegion { } + MouseArea { } } } } diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml index 4c46ec1..396e27d 100644 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml +++ b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml @@ -30,7 +30,7 @@ Item { Text { } } } - MouseRegion { } + MouseArea { } } } } diff --git a/tools/qmlviewer/content/Browser.qml b/tools/qmlviewer/content/Browser.qml index 446045b..35120bc 100644 --- a/tools/qmlviewer/content/Browser.qml +++ b/tools/qmlviewer/content/Browser.qml @@ -90,7 +90,7 @@ Rectangle { font.pixelSize: 32 color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText } - MouseRegion { + MouseArea { id: mouseRegion anchors.fill: parent onClicked: { launch() } @@ -211,7 +211,7 @@ Rectangle { color: "transparent" Image { anchors.centerIn: parent; source: "images/up.png" } - MouseRegion { id: upRegion; anchors.centerIn: parent + MouseArea { id: upRegion; anchors.centerIn: parent width: 56 height: 56 onClicked: if (folders.parentFolder != "") up() |