diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-23 05:17:41 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-23 05:17:41 (GMT) |
commit | 3083b436bd3adc6280d3b7ebcb75358454cb9623 (patch) | |
tree | 0eb451db7cc183c126e19617faa26b12f8af3c51 /examples | |
parent | 055fa76e7575be55899127de2d254e0f0e90a1db (diff) | |
parent | 39d728dd76efa10ca297b76ed08a5cd1c0235b3f (diff) | |
download | Qt-3083b436bd3adc6280d3b7ebcb75358454cb9623.zip Qt-3083b436bd3adc6280d3b7ebcb75358454cb9623.tar.gz Qt-3083b436bd3adc6280d3b7ebcb75358454cb9623.tar.bz2 |
Merge remote branch 'origin/master' into bearermanagement/staging
Diffstat (limited to 'examples')
71 files changed, 218 insertions, 114 deletions
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/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 482d1b7..6a031a4 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -16,6 +16,7 @@ Rectangle { Image { id: face smooth: true + anchors.centerIn: parent source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 80a762b..90ea516 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -14,6 +14,7 @@ Rectangle { Image { id: face smooth: true + anchors.centerIn: parent source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 283e24b..2e2b6ed 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -12,6 +12,7 @@ Rectangle { Image { id: face smooth: true + anchors.centerIn: parent source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index c3ef859..8230e49 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -13,6 +13,7 @@ Rectangle { Image { id: face smooth: true + anchors.centerIn: parent source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 961ac04..eae4d16 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -13,6 +13,7 @@ Rectangle { Image { id: face smooth: true + anchors.centerIn: parent source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 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/extending/attached/birthdayparty.cpp b/examples/declarative/extending/attached/birthdayparty.cpp index 9dc13de..ffdda57 100644 --- a/examples/declarative/extending/attached/birthdayparty.cpp +++ b/examples/declarative/extending/attached/birthdayparty.cpp @@ -72,9 +72,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h index bd8952b..9ba0f8b 100644 --- a/examples/declarative/extending/attached/birthdayparty.h +++ b/examples/declarative/extending/attached/birthdayparty.h @@ -65,7 +65,7 @@ class BirthdayParty : public QObject { Q_OBJECT Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) Q_CLASSINFO("DefaultProperty", "guests") public: BirthdayParty(QObject *parent = 0); @@ -73,12 +73,14 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; static BirthdayPartyAttached *qmlAttachedProperties(QObject *); private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) diff --git a/examples/declarative/extending/attached/main.cpp b/examples/declarative/extending/attached/main.cpp index 2ec783f..27a9287 100644 --- a/examples/declarative/extending/attached/main.cpp +++ b/examples/declarative/extending/attached/main.cpp @@ -61,8 +61,8 @@ int main(int argc, char ** argv) else qWarning() << "She is inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) { - Person *guest = party->guests()->at(ii); + for (int ii = 0; ii < party->guestCount(); ++ii) { + Person *guest = party->guest(ii); QDate rsvpDate; QObject *attached = diff --git a/examples/declarative/extending/binding/birthdayparty.cpp b/examples/declarative/extending/binding/birthdayparty.cpp index 8a409af..62b9c7b 100644 --- a/examples/declarative/extending/binding/birthdayparty.cpp +++ b/examples/declarative/extending/binding/birthdayparty.cpp @@ -77,9 +77,19 @@ void BirthdayParty::setCelebrant(Person *c) emit celebrantChanged(); } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } void BirthdayParty::startParty() diff --git a/examples/declarative/extending/binding/birthdayparty.h b/examples/declarative/extending/binding/birthdayparty.h index 5651c65..8bdb76a 100644 --- a/examples/declarative/extending/binding/birthdayparty.h +++ b/examples/declarative/extending/binding/birthdayparty.h @@ -71,7 +71,7 @@ Q_OBJECT // ![0] Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant NOTIFY celebrantChanged) // ![0] -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) Q_PROPERTY(QString speaker READ speaker WRITE setSpeaker) Q_CLASSINFO("DefaultProperty", "guests") public: @@ -80,7 +80,9 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; QString speaker() const; void setSpeaker(const QString &); @@ -94,7 +96,7 @@ signals: private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) diff --git a/examples/declarative/extending/binding/main.cpp b/examples/declarative/extending/binding/main.cpp index 4ad9929..ba38e82 100644 --- a/examples/declarative/extending/binding/main.cpp +++ b/examples/declarative/extending/binding/main.cpp @@ -61,8 +61,8 @@ int main(int argc, char ** argv) else qWarning() << "She is inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) { - Person *guest = party->guests()->at(ii); + for (int ii = 0; ii < party->guestCount(); ++ii) { + Person *guest = party->guest(ii); QDate rsvpDate; QObject *attached = diff --git a/examples/declarative/extending/coercion/birthdayparty.cpp b/examples/declarative/extending/coercion/birthdayparty.cpp index 014d307..15a4ca9 100644 --- a/examples/declarative/extending/coercion/birthdayparty.cpp +++ b/examples/declarative/extending/coercion/birthdayparty.cpp @@ -55,9 +55,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/coercion/birthdayparty.h b/examples/declarative/extending/coercion/birthdayparty.h index 8563ec3..5a9eb08 100644 --- a/examples/declarative/extending/coercion/birthdayparty.h +++ b/examples/declarative/extending/coercion/birthdayparty.h @@ -50,7 +50,7 @@ class BirthdayParty : public QObject Q_OBJECT // ![0] Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) // ![0] public: BirthdayParty(QObject *parent = 0); @@ -58,11 +58,13 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPE(BirthdayParty); diff --git a/examples/declarative/extending/coercion/main.cpp b/examples/declarative/extending/coercion/main.cpp index c6cc847..ccbee83 100644 --- a/examples/declarative/extending/coercion/main.cpp +++ b/examples/declarative/extending/coercion/main.cpp @@ -60,8 +60,9 @@ int main(int argc, char ** argv) qWarning() << "He is inviting:"; else qWarning() << "She is inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) - qWarning() << " " << party->guests()->at(ii)->name(); + + for (int ii = 0; ii < party->guestCount(); ++ii) + qWarning() << " " << party->guest(ii)->name(); } else { qWarning() << "An error occured"; } diff --git a/examples/declarative/extending/default/birthdayparty.cpp b/examples/declarative/extending/default/birthdayparty.cpp index 014d307..15a4ca9 100644 --- a/examples/declarative/extending/default/birthdayparty.cpp +++ b/examples/declarative/extending/default/birthdayparty.cpp @@ -55,9 +55,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/default/birthdayparty.h b/examples/declarative/extending/default/birthdayparty.h index 869b32c..f25f8c2 100644 --- a/examples/declarative/extending/default/birthdayparty.h +++ b/examples/declarative/extending/default/birthdayparty.h @@ -50,7 +50,7 @@ class BirthdayParty : public QObject { Q_OBJECT Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) Q_CLASSINFO("DefaultProperty", "guests") public: BirthdayParty(QObject *parent = 0); @@ -58,11 +58,13 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; // ![0] QML_DECLARE_TYPE(BirthdayParty); diff --git a/examples/declarative/extending/default/main.cpp b/examples/declarative/extending/default/main.cpp index c6cc847..ccbee83 100644 --- a/examples/declarative/extending/default/main.cpp +++ b/examples/declarative/extending/default/main.cpp @@ -60,8 +60,9 @@ int main(int argc, char ** argv) qWarning() << "He is inviting:"; else qWarning() << "She is inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) - qWarning() << " " << party->guests()->at(ii)->name(); + + for (int ii = 0; ii < party->guestCount(); ++ii) + qWarning() << " " << party->guest(ii)->name(); } else { qWarning() << "An error occured"; } diff --git a/examples/declarative/extending/grouped/birthdayparty.cpp b/examples/declarative/extending/grouped/birthdayparty.cpp index 014d307..15a4ca9 100644 --- a/examples/declarative/extending/grouped/birthdayparty.cpp +++ b/examples/declarative/extending/grouped/birthdayparty.cpp @@ -55,9 +55,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/grouped/birthdayparty.h b/examples/declarative/extending/grouped/birthdayparty.h index 3f4a3a6..fd0d955 100644 --- a/examples/declarative/extending/grouped/birthdayparty.h +++ b/examples/declarative/extending/grouped/birthdayparty.h @@ -49,7 +49,7 @@ class BirthdayParty : public QObject { Q_OBJECT Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) Q_CLASSINFO("DefaultProperty", "guests") public: BirthdayParty(QObject *parent = 0); @@ -57,11 +57,13 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPE(BirthdayParty); diff --git a/examples/declarative/extending/grouped/main.cpp b/examples/declarative/extending/grouped/main.cpp index 23ba8bf..79aaab5 100644 --- a/examples/declarative/extending/grouped/main.cpp +++ b/examples/declarative/extending/grouped/main.cpp @@ -62,8 +62,8 @@ int main(int argc, char ** argv) qWarning() << "She is inviting:"; Person *bestShoe = 0; - for (int ii = 0; ii < party->guests()->count(); ++ii) { - Person *guest = party->guests()->at(ii); + for (int ii = 0; ii < party->guestCount(); ++ii) { + Person *guest = party->guest(ii); qWarning() << " " << guest->name(); if (!bestShoe || bestShoe->shoe()->price() < guest->shoe()->price()) diff --git a/examples/declarative/extending/properties/birthdayparty.cpp b/examples/declarative/extending/properties/birthdayparty.cpp index 332b090..23e6e58 100644 --- a/examples/declarative/extending/properties/birthdayparty.cpp +++ b/examples/declarative/extending/properties/birthdayparty.cpp @@ -56,9 +56,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } // ![0] diff --git a/examples/declarative/extending/properties/birthdayparty.h b/examples/declarative/extending/properties/birthdayparty.h index ceefd5b..e5d316c 100644 --- a/examples/declarative/extending/properties/birthdayparty.h +++ b/examples/declarative/extending/properties/birthdayparty.h @@ -54,7 +54,7 @@ Q_OBJECT Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) // ![1] // ![2] -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) // ![2] // ![3] public: @@ -63,11 +63,13 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPE(BirthdayParty); // ![3] diff --git a/examples/declarative/extending/properties/main.cpp b/examples/declarative/extending/properties/main.cpp index 229e59a..97d7905 100644 --- a/examples/declarative/extending/properties/main.cpp +++ b/examples/declarative/extending/properties/main.cpp @@ -56,8 +56,8 @@ int main(int argc, char ** argv) if (party && party->celebrant()) { qWarning() << party->celebrant()->name() << "is having a birthday!"; qWarning() << "They are inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) - qWarning() << " " << party->guests()->at(ii)->name(); + for (int ii = 0; ii < party->guestCount(); ++ii) + qWarning() << " " << party->guest(ii)->name(); } else { qWarning() << "An error occured"; } diff --git a/examples/declarative/extending/signal/birthdayparty.cpp b/examples/declarative/extending/signal/birthdayparty.cpp index 88c5459..d8686f0 100644 --- a/examples/declarative/extending/signal/birthdayparty.cpp +++ b/examples/declarative/extending/signal/birthdayparty.cpp @@ -72,9 +72,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } void BirthdayParty::startParty() diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h index 8ce5d7b..30ed43b 100644 --- a/examples/declarative/extending/signal/birthdayparty.h +++ b/examples/declarative/extending/signal/birthdayparty.h @@ -65,7 +65,7 @@ class BirthdayParty : public QObject { Q_OBJECT Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) Q_CLASSINFO("DefaultProperty", "guests") public: BirthdayParty(QObject *parent = 0); @@ -73,7 +73,9 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; static BirthdayPartyAttached *qmlAttachedProperties(QObject *); @@ -85,7 +87,7 @@ signals: private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) diff --git a/examples/declarative/extending/signal/main.cpp b/examples/declarative/extending/signal/main.cpp index 4e981c5..eb3bb4b 100644 --- a/examples/declarative/extending/signal/main.cpp +++ b/examples/declarative/extending/signal/main.cpp @@ -61,8 +61,8 @@ int main(int argc, char ** argv) else qWarning() << "She is inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) { - Person *guest = party->guests()->at(ii); + for (int ii = 0; ii < party->guestCount(); ++ii) { + Person *guest = party->guest(ii); QDate rsvpDate; QObject *attached = diff --git a/examples/declarative/extending/valuesource/birthdayparty.cpp b/examples/declarative/extending/valuesource/birthdayparty.cpp index b483f68..a5b3fab 100644 --- a/examples/declarative/extending/valuesource/birthdayparty.cpp +++ b/examples/declarative/extending/valuesource/birthdayparty.cpp @@ -72,9 +72,19 @@ void BirthdayParty::setCelebrant(Person *c) m_celebrant = c; } -QmlList<Person *> *BirthdayParty::guests() +QmlListProperty<Person> BirthdayParty::guests() { - return &m_guests; + return QmlListProperty<Person>(this, m_guests); +} + +int BirthdayParty::guestCount() const +{ + return m_guests.count(); +} + +Person *BirthdayParty::guest(int index) const +{ + return m_guests.at(index); } void BirthdayParty::startParty() diff --git a/examples/declarative/extending/valuesource/birthdayparty.h b/examples/declarative/extending/valuesource/birthdayparty.h index e7ca461..b5a0522 100644 --- a/examples/declarative/extending/valuesource/birthdayparty.h +++ b/examples/declarative/extending/valuesource/birthdayparty.h @@ -66,7 +66,7 @@ class BirthdayParty : public QObject { Q_OBJECT Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) -Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_PROPERTY(QmlListProperty<Person> guests READ guests) // ![0] Q_PROPERTY(QString speaker READ speaker WRITE setSpeaker) // ![0] @@ -77,7 +77,10 @@ public: Person *celebrant() const; void setCelebrant(Person *); - QmlList<Person *> *guests(); + QmlListProperty<Person> guests(); + int guestCount() const; + Person *guest(int) const; + QString speaker() const; void setSpeaker(const QString &); @@ -90,7 +93,7 @@ signals: private: Person *m_celebrant; - QmlConcreteList<Person *> m_guests; + QList<Person *> m_guests; }; QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) diff --git a/examples/declarative/extending/valuesource/main.cpp b/examples/declarative/extending/valuesource/main.cpp index 4ad9929..ba38e82 100644 --- a/examples/declarative/extending/valuesource/main.cpp +++ b/examples/declarative/extending/valuesource/main.cpp @@ -61,8 +61,8 @@ int main(int argc, char ** argv) else qWarning() << "She is inviting:"; - for (int ii = 0; ii < party->guests()->count(); ++ii) { - Person *guest = party->guests()->at(ii); + for (int ii = 0; ii < party->guestCount(); ++ii) { + Person *guest = party->guest(ii); QDate rsvpDate; QObject *attached = 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/objectlistmodel/main.cpp b/examples/declarative/objectlistmodel/main.cpp index 5eb6b7d..9e38bea 100644 --- a/examples/declarative/objectlistmodel/main.cpp +++ b/examples/declarative/objectlistmodel/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char ** argv) dataList.append(new DataObject("Item 4", "yellow")); QmlContext *ctxt = view.rootContext(); - ctxt->setContextProperty("myModel", QVariant::fromValue(&dataList)); + ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); view.execute(); view.show(); 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: { |