summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/flickr/common/ImageDetails.qml1
-rw-r--r--doc/src/declarative/extending.qdoc15
-rw-r--r--doc/src/declarative/pics/3d-rotation-axis.pngbin14304 -> 11078 bytes
-rw-r--r--doc/src/declarative/pics/axisrotation.pngbin3425 -> 8891 bytes
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc1
-rw-r--r--doc/src/snippets/declarative/rotation.qml16
-rw-r--r--examples/declarative/animation/color-animation.qml6
-rw-r--r--examples/declarative/animation/property-animation.qml2
-rw-r--r--examples/declarative/extending/attached/birthdayparty.h8
-rw-r--r--examples/declarative/extending/binding/birthdayparty.h8
-rw-r--r--examples/declarative/extending/signal/birthdayparty.h8
-rw-r--r--examples/declarative/extending/valuesource/birthdayparty.h8
-rw-r--r--examples/declarative/progressbar/ProgressBar.qml2
-rw-r--r--examples/declarative/snow/ImageBatch.qml2
-rw-r--r--examples/declarative/snow/Loading.qml2
-rw-r--r--examples/declarative/states/states.qml54
-rw-r--r--examples/declarative/states/transitions.qml54
-rw-r--r--examples/declarative/states/user.pngbin0 -> 4886 bytes
-rw-r--r--examples/declarative/tutorials/helloworld/tutorial3.qml2
-rw-r--r--src/declarative/fx/qfxgridview.cpp5
-rw-r--r--src/declarative/fx/qfxitem.cpp52
-rw-r--r--src/declarative/fx/qfxlistview.cpp5
-rw-r--r--src/declarative/fx/qfxpainteditem.cpp2
-rw-r--r--src/declarative/fx/qfxrect.cpp7
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp15
-rw-r--r--src/declarative/qml/qml.pri2
-rw-r--r--src/declarative/qml/qmlcleanup.cpp82
-rw-r--r--src/declarative/qml/qmlcleanup_p.h79
-rw-r--r--src/declarative/qml/qmlengine.cpp11
-rw-r--r--src/declarative/qml/qmlengine_p.h4
-rw-r--r--src/declarative/qml/qmlintegercache.cpp10
-rw-r--r--src/declarative/qml/qmlintegercache_p.h7
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp1
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp14
-rw-r--r--src/declarative/qml/qmlpropertycache_p.h8
-rw-r--r--src/declarative/qml/qmlpropertyvalueinterceptor.cpp1
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.cpp1
-rw-r--r--src/declarative/qml/qmltypenamecache.cpp10
-rw-r--r--src/declarative/qml/qmltypenamecache_p.h6
-rw-r--r--src/declarative/util/qmllistaccessor.cpp2
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp6
-rw-r--r--tools/qmldebugger/canvasframerate.cpp18
-rw-r--r--tools/qmldebugger/canvasframerate.h4
-rw-r--r--tools/qmldebugger/engine.cpp21
-rw-r--r--tools/qmldebugger/engine.h5
-rw-r--r--tools/qmldebugger/expressionquerywidget.cpp27
-rw-r--r--tools/qmldebugger/expressionquerywidget.h7
-rw-r--r--tools/qmldebugger/objectpropertiesview.cpp9
-rw-r--r--tools/qmldebugger/objectpropertiesview.h5
-rw-r--r--tools/qmldebugger/objecttree.cpp9
-rw-r--r--tools/qmldebugger/objecttree.h5
-rw-r--r--tools/qmldebugger/qmldebugger.cpp1
-rw-r--r--tools/qmldebugger/watchtable.cpp13
-rw-r--r--tools/qmldebugger/watchtable.h5
54 files changed, 493 insertions, 155 deletions
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml
index b8b7d29..cc00773 100644
--- a/demos/declarative/flickr/common/ImageDetails.qml
+++ b/demos/declarative/flickr/common/ImageDetails.qml
@@ -20,6 +20,7 @@ Flipable {
transform: Rotation {
id: detailsRotation
+ origin.y: container.height / 2;
origin.x: container.width / 2;
axis.y: 1; axis.z: 0
}
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index db35961..b872632 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -300,11 +300,22 @@ attachment object are those that become available for use as the attached
property block.
Any QML type can become an attaching type by declaring the
-\c qmlAttachedProperties() public function:
+\c qmlAttachedProperties() public function and declaring that the class has
+QML_HAS_ATTACHED_PROPERTIES:
\quotation
\code
-static AttachedPropertiesType *qmlAttachedProperties(QObject *object)
+class MyType : public QObject {
+ Q_OBJECT
+public:
+
+ ...
+
+ static AttachedPropertiesType *qmlAttachedProperties(QObject *object);
+};
+
+QML_DECLARE_TYPEINFO(MyType, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(MyType)
\endcode
Return an attachment object, of type \a AttachedPropertiesType, for the
attachee \a object instance. It is customary, though not strictly required, for
diff --git a/doc/src/declarative/pics/3d-rotation-axis.png b/doc/src/declarative/pics/3d-rotation-axis.png
index 1b17261..b940215 100644
--- a/doc/src/declarative/pics/3d-rotation-axis.png
+++ b/doc/src/declarative/pics/3d-rotation-axis.png
Binary files differ
diff --git a/doc/src/declarative/pics/axisrotation.png b/doc/src/declarative/pics/axisrotation.png
index 409a9e9..4cddcdf 100644
--- a/doc/src/declarative/pics/axisrotation.png
+++ b/doc/src/declarative/pics/axisrotation.png
Binary files differ
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index 7be98db..ba2d70e 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -84,6 +84,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+
\o \l {QML Documents}
\o \l {Property Binding}
\o \l {ECMAScript Blocks}
+\o \l {QML Scope}
\o \l {Network Transparency}
\o \l {qmlmodels}{Data Models}
\o \l {anchor-layout}{Anchor-based Layout}
diff --git a/doc/src/snippets/declarative/rotation.qml b/doc/src/snippets/declarative/rotation.qml
index aaaebee..4a67dcb 100644
--- a/doc/src/snippets/declarative/rotation.qml
+++ b/doc/src/snippets/declarative/rotation.qml
@@ -4,25 +4,29 @@ Rectangle {
width: 360; height: 80
color: "white"
//! [0]
- HorizontalLayout {
- margin: 10
+ Row {
+ x: 10; y: 10
spacing: 10
Image { source: "pics/qt.png" }
Image {
source: "pics/qt.png"
- transform: Rotation { origin.x: 30; axis.y: 60; axis.z: 0 angle: 18 }
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 18 }
+ smooth: true
}
Image {
source: "pics/qt.png"
- transform: Rotation { origin.x: 30; axis.y: 60; axis.z: 0 angle: 36 }
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 36 }
+ smooth: true
}
Image {
source: "pics/qt.png"
- transform: Rotation { origin.x: 30; axis.y: 60; axis.z: 0; angle: 54 }
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 54 }
+ smooth: true
}
Image {
source: "pics/qt.png"
- transform: Rotation { origin.x: 30; axis.y: 60; axis.z: 0; angle: 72 }
+ transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 72 }
+ smooth: true
}
}
//! [0]
diff --git a/examples/declarative/animation/color-animation.qml b/examples/declarative/animation/color-animation.qml
index 0cf8a44..edb0659 100644
--- a/examples/declarative/animation/color-animation.qml
+++ b/examples/declarative/animation/color-animation.qml
@@ -30,18 +30,18 @@ Item {
// the sun, moon, and stars
Item {
width: parent.width; height: 2 * parent.height
- transformOrigin: "Center"
+ transformOrigin: Item.Center
rotation: SequentialAnimation {
running: true; repeat: true
NumberAnimation { from: 0; to: 360; duration: 10000 }
}
Image {
source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter
- transformOrigin: "Center"; rotation: -3 * parent.rotation
+ transformOrigin: Item.Center; rotation: -3 * parent.rotation
}
Image {
source: "images/moon.png"; y: parent.height - 74; anchors.horizontalCenter: parent.horizontalCenter
- transformOrigin: "Center"; rotation: -parent.rotation
+ transformOrigin: Item.Center; rotation: -parent.rotation
}
Particles {
x: 0; y: parent.height/2; width: parent.width; height: parent.height/2
diff --git a/examples/declarative/animation/property-animation.qml b/examples/declarative/animation/property-animation.qml
index 4e0f6f4..0256137 100644
--- a/examples/declarative/animation/property-animation.qml
+++ b/examples/declarative/animation/property-animation.qml
@@ -26,7 +26,7 @@ Item {
Image {
anchors.horizontalCenter: parent.horizontalCenter
source: "images/shadow.png"; y: smiley.minHeight + 58
- transformOrigin: "Center"
+ transformOrigin: Item.Center
// The scale property depends on the y position of the smiley face.
scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight)
diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h
index 8249af5..2ea065c 100644
--- a/examples/declarative/extending/attached/birthdayparty.h
+++ b/examples/declarative/extending/attached/birthdayparty.h
@@ -9,7 +9,7 @@
class BirthdayPartyAttached : public QObject
{
Q_OBJECT
-Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp);
+Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
public:
BirthdayPartyAttached(QObject *object);
@@ -19,7 +19,7 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached);
+QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -40,6 +40,8 @@ private:
Person *m_celebrant;
QmlConcreteList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
+
+QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/binding/birthdayparty.h b/examples/declarative/extending/binding/birthdayparty.h
index 6905746..2757561 100644
--- a/examples/declarative/extending/binding/birthdayparty.h
+++ b/examples/declarative/extending/binding/birthdayparty.h
@@ -10,7 +10,7 @@
class BirthdayPartyAttached : public QObject
{
Q_OBJECT
-Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged);
+Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged)
public:
BirthdayPartyAttached(QObject *object);
@@ -23,7 +23,7 @@ signals:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached);
+QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -56,6 +56,8 @@ private:
Person *m_celebrant;
QmlConcreteList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
+
+QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h
index 14d7c29..5dea2e8 100644
--- a/examples/declarative/extending/signal/birthdayparty.h
+++ b/examples/declarative/extending/signal/birthdayparty.h
@@ -9,7 +9,7 @@
class BirthdayPartyAttached : public QObject
{
Q_OBJECT
-Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp);
+Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
public:
BirthdayPartyAttached(QObject *object);
@@ -19,7 +19,7 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached);
+QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -47,6 +47,8 @@ private:
Person *m_celebrant;
QmlConcreteList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
+
+QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/valuesource/birthdayparty.h b/examples/declarative/extending/valuesource/birthdayparty.h
index fd25f28..75a2477 100644
--- a/examples/declarative/extending/valuesource/birthdayparty.h
+++ b/examples/declarative/extending/valuesource/birthdayparty.h
@@ -10,7 +10,7 @@
class BirthdayPartyAttached : public QObject
{
Q_OBJECT
-Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp);
+Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
public:
BirthdayPartyAttached(QObject *object);
@@ -20,7 +20,7 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached);
+QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -52,6 +52,8 @@ private:
Person *m_celebrant;
QmlConcreteList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
+
+QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/progressbar/ProgressBar.qml b/examples/declarative/progressbar/ProgressBar.qml
index 48346ac..302caa9 100644
--- a/examples/declarative/progressbar/ProgressBar.qml
+++ b/examples/declarative/progressbar/ProgressBar.qml
@@ -21,7 +21,7 @@ Item {
id: highlight; radius: 2
anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom
anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3
- width: EaseFollow { source: highlight.widthDest; duration: 100 }
+ width: EaseFollow { source: highlight.widthDest; duration: 1000 }
gradient: Gradient {
GradientStop { id: g1; position: 0.0 }
GradientStop { id: g2; position: 1.0 }
diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml
index 3945087..dfe2a46 100644
--- a/examples/declarative/snow/ImageBatch.qml
+++ b/examples/declarative/snow/ImageBatch.qml
@@ -38,7 +38,7 @@ GridView {
delegate: Item {
id: root
property bool isSelected: GridView.isCurrentItem && grid.isSelected
- transformOrigin: "Center"
+ transformOrigin: Item.Center
width: grid.imageWidth; height: grid.imageHeight;
Image { id: flickrImage; source: url; fillMode: "PreserveAspectFit"; smooth: true; anchors.fill: parent;
diff --git a/examples/declarative/snow/Loading.qml b/examples/declarative/snow/Loading.qml
index 054656a..238d9c7 100644
--- a/examples/declarative/snow/Loading.qml
+++ b/examples/declarative/snow/Loading.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Image {
- id: loading; source: "pics/loading.png"; transformOrigin: "Center"
+ id: loading; source: "pics/loading.png"; transformOrigin: Item.Center
rotation: NumberAnimation {
id: rotationAnimation; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900
}
diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml
index acab2f0..6f6b40f 100644
--- a/examples/declarative/states/states.qml
+++ b/examples/declarative/states/states.qml
@@ -2,47 +2,49 @@ import Qt 4.6
Rectangle {
id: page
- width: 300; height: 300; color: "white"
- // A target region. Clicking in here sets the state to '' - the default state
+ width: 640; height: 480; color: "#343434"
+
+ // A target region. Clicking in here sets the state to the default state
Rectangle {
- x: 0; y: 0; width: 50; height: 50
- color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { page.state='' } }
+ id: initialPosition
+ 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 = '' }
}
+
// Another target region. Clicking in here sets the state to 'Position1'
Rectangle {
- x: 150; y: 50; width: 50; height: 50
- color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { page.state='Position1' } }
+ id: position1
+ 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' }
}
+
// Another target region. Clicking in here sets the state to 'Position2'
Rectangle {
- x: 0; y: 200; width: 50; height: 50
- color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { page.state='Position2' } }
+ id: position2
+ 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' }
}
- // Rect which will be moved when my state changes
- Rectangle { id: myrect; width: 50; height: 50; color: "red" }
+
+ // The image which will be moved when my state changes
+ Image { id: user; source: "user.png"; x: initialPosition.x; y: initialPosition.y }
states: [
- // In state 'Position1', change the 'myrect' item x, y to 150, 50.
+ // In state 'Position1', change the 'user' item position to rect2's position.
State {
name: "Position1"
- PropertyChanges {
- target: myrect
- x: 150
- y: 50
- }
+ PropertyChanges { target: user; x: position1.x; y: position1.y }
},
- // In state 'Position2', change y to 100. We do not specify 'x' here -
- // it will therefore be restored to its default value of 0, if it
- // had been changed.
+
+ // In state 'Position2', change the 'user' item position to rect3's position.
State {
name: "Position2"
- PropertyChanges {
- target: myrect
- y: 200
- }
+ PropertyChanges { target: user; x: position2.x; y: position2.y }
}
]
}
diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml
index cc6894d..ba97d9be 100644
--- a/examples/declarative/states/transitions.qml
+++ b/examples/declarative/states/transitions.qml
@@ -2,47 +2,49 @@ import Qt 4.6
Rectangle {
id: page
- width: 300; height: 300; color: "white"
- // A target region. Clicking in here sets the state to '' - the default state
+ width: 640; height: 480; color: "#343434"
+
+ // A target region. Clicking in here sets the state to the default state
Rectangle {
- x: 0; y: 0; width: 50; height: 50
- color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { page.state='' } }
+ id: initialPosition
+ 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 = '' }
}
+
// Another target region. Clicking in here sets the state to 'Position1'
Rectangle {
- x: 150; y: 50; width: 50; height: 50
- color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { page.state='Position1' } }
+ id: position1
+ 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' }
}
+
// Another target region. Clicking in here sets the state to 'Position2'
Rectangle {
- x: 0; y: 200; width: 50; height: 50
- color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { page.state='Position2' } }
+ id: position2
+ 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' }
}
- // Rect which will be moved when my state changes
- Rectangle { id: myrect; width: 50; height: 50; color: "red" }
+
+ // The image which will be moved when my state changes
+ Image { id: user; source: "user.png"; x: initialPosition.x; y: initialPosition.y }
states: [
- // In state 'Position1', change the 'myrect' item x, y to 150, 50.
+ // In state 'Position1', change the 'user' item position to rect2's position.
State {
name: "Position1"
- PropertyChanges {
- target: myrect
- x: 150
- y: 50
- }
+ PropertyChanges { target: user; x: position1.x; y: position1.y }
},
- // In state 'Position2', change y to 100. We do not specify 'x' here -
- // it will therefore be restored to its default value of 0, if it
- // had been changed.
+
+ // In state 'Position2', change the 'user' item position to rect3's position.
State {
name: "Position2"
- PropertyChanges {
- target: myrect
- y: 200
- }
+ PropertyChanges { target: user; x: position2.x; y: position2.y }
}
]
diff --git a/examples/declarative/states/user.png b/examples/declarative/states/user.png
new file mode 100644
index 0000000..dd7d7a2
--- /dev/null
+++ b/examples/declarative/states/user.png
Binary files differ
diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml
index d641eba..534d663 100644
--- a/examples/declarative/tutorials/helloworld/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/tutorial3.qml
@@ -11,7 +11,7 @@ Rectangle {
text: "Hello world!"
font.pointSize: 24; font.bold: true
y: 30; anchors.horizontalCenter: page.horizontalCenter
- transformOrigin: "Center"
+ transformOrigin: Item.Center
//![1]
MouseRegion { id: mouseRegion; anchors.fill: parent }
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index 36c06a4..0b2a935 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -736,14 +736,13 @@ QFxGridView::~QFxGridView()
\endcode
*/
-//XXX change to \qmlattachedsignal when it exists.
/*!
- \qmlattachedproperty void GridView::onAdd
+ \qmlattachedsignal GridView::onAdd()
This attached handler is called immediately after an item is added to the view.
*/
/*!
- \qmlattachedproperty void GridView::onRemove
+ \qmlattachedsignal GridView::onRemove()
This attached handler is called immediately before an item is removed from the view.
*/
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 317a284..9c668ac 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -79,15 +79,10 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
#include "qfxeffects.cpp"
/*!
- \qmlclass Transform
- \brief A transformation.
-*/
-
-/*!
\qmlclass Scale
- \brief A Scale object provides a way to scale an Item.
+ \brief The Scale object provides a way to scale an Item.
- The scale object gives more control over scaling than using Item's scale property. Specifically,
+ The Scale object gives more control over scaling than using Item's scale property. Specifically,
it allows a different scale for the x and y axes, and allows the scale to be relative to an
arbitrary point.
@@ -105,13 +100,14 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
\qmlproperty real Scale::origin.x
\qmlproperty real Scale::origin.y
- The origin point for the scale. The scale will be relative to this point.
+ The point that the item is scaled from (i.e., the point that stays fixed relative to the parent as
+ the rest of the item grows). By default the origin is 0, 0.
*/
/*!
\qmlproperty real Scale::xScale
- The scaling factor for the X axis.
+ The scaling factor for the X axis.
*/
/*!
@@ -122,7 +118,10 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
/*!
\qmlclass Rotation
- \brief A Rotation object provides a way to rotate an Item around a point using an axis in 3D space.
+ \brief The Rotation object provides a way to rotate an Item.
+
+ The Rotation object gives more control over rotation than using Item's rotation property.
+ Specifically, it allows (z axis) rotation to be relative to an arbitrary point.
The following example rotates a Rectangle around its interior point 25, 25:
\qml
@@ -133,7 +132,10 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
}
\endqml
- Here is an example of various rotations applied to an \l Image.
+ Rotation also provides a way to specify 3D-like rotations for Items. For these types of
+ rotations you must specify the axis to rotate around in addition to the origin point.
+
+ The following example shows various 3D-like rotations applied to an \l Image.
\snippet doc/src/snippets/declarative/rotation.qml 0
\image axisrotation.png
@@ -143,7 +145,8 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
\qmlproperty real Rotation::origin.x
\qmlproperty real Rotation::origin.y
- The point to rotate around.
+ The origin point of the rotation (i.e., the point that stays fixed relative to the parent as
+ the rest of the item rotates). By default the origin is 0, 0.
*/
/*!
@@ -151,16 +154,18 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
\qmlproperty real Rotation::axis.y
\qmlproperty real Rotation::axis.z
- A rotation axis is specified by a vector in 3D space By default the vector defines a rotation around the z-Axis.
+ The axis to rotate around. For simple (2D) rotation around a point, you do not need to specify an axis,
+ as the default axis is the z axis (\c{ axis { x: 0; y: 0; z: 0 } }).
- \image 3d-rotation-axis.png
+ For a typical 3D-like rotation you will usually specify both the origin and the axis.
+ \image 3d-rotation-axis.png
*/
/*!
\qmlproperty real Rotation::angle
- The angle, in degrees, to rotate.
+ The angle to rotate, in degrees clockwise.
*/
@@ -1193,6 +1198,19 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj)
}
/*!
+ \class QFxItem
+ \brief QFxItem is the most basic of all visual items in QML.
+
+ All visual items in Qt Declarative inherit from QFxItem. Although QFxItem
+ has no visual appearance, it defines all the properties that are
+ common across visual items - such as the x and y position, the
+ width and height, \l {anchor-layout}{anchoring} and key handling.
+
+ You can subclass QFxItem to provide your own custom visual item that inherits
+ these features.
+*/
+
+/*!
\qmlclass Item QFxItem
\brief The Item is the most basic of all visual items in QML.
@@ -1359,7 +1377,7 @@ QFxItem::~QFxItem()
\qml
Image {
source: "myimage.png"
- transformOrigin: "Center"
+ transformOrigin: Item.Center
scale: 4
}
\endqml
@@ -2113,7 +2131,7 @@ void QFxItem::setBaselineOffset(qreal offset)
/*!
\qmlproperty real Item::rotation
- This property holds the rotation of the item in degrees.
+ This property holds the rotation of the item in degrees clockwise.
This specifies how many degrees to rotate the item around its transformOrigin.
The default rotation is 0 degrees (i.e. not rotated at all).
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 23bf573..1a4a60c 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -926,14 +926,13 @@ QFxListView::~QFxListView()
\endcode
*/
-//XXX change to \qmlattachedsignal when it exists.
/*!
- \qmlattachedproperty void ListView::onAdd
+ \qmlattachedsignal ListView::onAdd()
This attached handler is called immediately after an item is added to the view.
*/
/*!
- \qmlattachedproperty void ListView::onRemove
+ \qmlattachedsignal ListView::onRemove()
This attached handler is called immediately before an item is removed from the view.
*/
diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp
index 05fcc93..e0ef99f 100644
--- a/src/declarative/fx/qfxpainteditem.cpp
+++ b/src/declarative/fx/qfxpainteditem.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QFxPaintedItem
\brief The QFxPaintedItem class is an abstract base class for QmlView items that want cached painting.
- \ingroup group_coreitems
+ \internal
This is a convenience class for implementing items that paint their contents
using a QPainter. The contents of the item are cached behind the scenes.
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index f35fe3d..d4207a6 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -43,6 +43,7 @@
#include "qfxrect_p.h"
#include <QPainter>
+#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Pen,QFxPen)
@@ -338,7 +339,8 @@ void QFxRect::generateRoundedRect()
Q_D(QFxRect);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- d->rectImage = QPixmap(d->radius*2 + 3 + pw*2, d->radius*2 + 3 + pw*2);
+ const int radius = qCeil(d->radius); //ensure odd numbered width/height so we get 1-pixel center
+ d->rectImage = QPixmap(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2);
d->rectImage.fill(Qt::transparent);
QPainter p(&(d->rectImage));
p.setRenderHint(QPainter::Antialiasing);
@@ -361,7 +363,7 @@ void QFxRect::generateBorderedRect()
Q_D(QFxRect);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- d->rectImage = QPixmap(d->getPen()->width()*2 + 3 + pw*2, d->getPen()->width()*2 + 3 + pw*2);
+ d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3);
d->rectImage.fill(Qt::transparent);
QPainter p(&(d->rectImage));
p.setRenderHint(QPainter::Antialiasing);
@@ -439,6 +441,7 @@ void QFxRect::drawRect(QPainter &p)
QMargins margins(xOffset, yOffset, xOffset, yOffset);
QTileRules rules(Qt::StretchTile, Qt::StretchTile);
+ //NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects
qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules);
if (d->smooth) {
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index a078da6..e1ac246 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -102,7 +102,7 @@ QHash<QObject*, QFxVisualItemModelAttached*> QFxVisualItemModelAttached::attache
class QFxVisualItemModelPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QFxVisualItemModel);
+ Q_DECLARE_PUBLIC(QFxVisualItemModel)
public:
QFxVisualItemModelPrivate() : QObjectPrivate(), children(this) {}
@@ -143,7 +143,7 @@ public:
\code
Item {
VisualItemModel {
- id: ItemModel
+ id: itemModel
Rectangle { height: 30; width: 80; color: "red" }
Rectangle { height: 30; width: 80; color: "green" }
Rectangle { height: 30; width: 80; color: "blue" }
@@ -151,7 +151,7 @@ public:
ListView {
anchors.fill: parent
- model: ItemModel
+ model: itemModel
}
}
\endcode
@@ -416,8 +416,13 @@ int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const cha
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
model->ensureRoles();
- if (model->m_roleNames.contains(QString::fromUtf8(name)))
+ if (model->m_roleNames.contains(QString::fromUtf8(name))) {
return QmlOpenMetaObject::createProperty(name, type);
+ } else if (model->m_listAccessor->type() == QmlListAccessor::QmlList) {
+ QObject *object = model->m_listAccessor->at(data->m_index).value<QObject*>();
+ if (object && object->property(name).isValid())
+ return QmlOpenMetaObject::createProperty(name, type);
+ }
} else {
model->ensureRoles();
QString sname = QString::fromUtf8(name);
@@ -448,7 +453,7 @@ QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro
return model->m_listAccessor->at(data->m_index);
} else {
// return any property of a single object instance.
- QObject *object = model->m_listAccessor->at(0).value<QObject*>();
+ QObject *object = model->m_listAccessor->at(data->m_index).value<QObject*>();
return object->property(prop.name());
}
} else if (model->m_listModelInterface) {
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index b6e86a8..cbc2f85 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -37,6 +37,7 @@ SOURCES += qml/qmlparser.cpp \
qml/qmetaobjectbuilder.cpp \
qml/qmlwatcher.cpp \
qml/qmlscript.cpp \
+ qml/qmlcleanup.cpp \
qml/qmlpropertycache.cpp \
qml/qmlintegercache.cpp \
qml/qmltypenamecache.cpp \
@@ -100,6 +101,7 @@ HEADERS += qml/qmlparser_p.h \
qml/qmlsqldatabase_p.h \
qml/qmetaobjectbuilder_p.h \
qml/qmlwatcher_p.h \
+ qml/qmlcleanup_p.h \
qml/qmlpropertycache_p.h \
qml/qmlintegercache_p.h \
qml/qmltypenamecache_p.h \
diff --git a/src/declarative/qml/qmlcleanup.cpp b/src/declarative/qml/qmlcleanup.cpp
new file mode 100644
index 0000000..7799cfc
--- /dev/null
+++ b/src/declarative/qml/qmlcleanup.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmlcleanup_p.h"
+#include <private/qmlengine_p.h>
+
+/*!
+\internal
+\class QmlCleanup
+\brief The QmlCleanup provides a callback when a QmlEngine is deleted.
+
+Any object that needs cleanup to occur before the QmlEngine's QScriptEngine is
+destroyed should inherit from QmlCleanup. The clear() virtual method will be
+called by QmlEngine just before it deletes the QScriptEngine.
+*/
+
+/*!
+\internal
+
+Create a QmlCleanup for \a engine
+*/
+QmlCleanup::QmlCleanup(QmlEngine *engine)
+: prev(0), next(0)
+{
+ Q_ASSERT(engine);
+ QmlEnginePrivate *p = QmlEnginePrivate::get(engine);
+
+ if (p->cleanup) next = p->cleanup;
+ p->cleanup = this;
+ prev = &p->cleanup;
+ if (next) next->prev = &next;
+}
+
+/*!
+\internal
+*/
+QmlCleanup::~QmlCleanup()
+{
+ if (prev) *prev = next;
+ if (next) next->prev = prev;
+ prev = 0;
+ next = 0;
+}
+
diff --git a/src/declarative/qml/qmlcleanup_p.h b/src/declarative/qml/qmlcleanup_p.h
new file mode 100644
index 0000000..e9196a3
--- /dev/null
+++ b/src/declarative/qml/qmlcleanup_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLCLEANUP_P_H
+#define QMLCLEANUP_P_H
+
+#include <QtCore/qglobal.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QmlEngine;
+class QmlCleanup
+{
+public:
+ QmlCleanup(QmlEngine *);
+ virtual ~QmlCleanup();
+
+protected:
+ virtual void clear() = 0;
+
+private:
+ friend class QmlEnginePrivate;
+ QmlCleanup **prev;
+ QmlCleanup *next;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMLCLEANUP_P_H
+
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index a3fb363..df865f1 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -128,7 +128,7 @@ static QString userLocalDataPath(const QString& app)
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
: rootContext(0), currentExpression(0),
isDebugging(false), contextClass(0), objectClass(0), valueTypeClass(0), globalClass(0),
- nodeListClass(0), namedNodeMapClass(0), sqlQueryClass(0), scriptEngine(this),
+ nodeListClass(0), namedNodeMapClass(0), sqlQueryClass(0), cleanup(0), scriptEngine(this),
componentAttacheds(0), rootComponent(0), networkAccessManager(0), typeManager(e), uniqueId(1)
{
QScriptValue qtObject =
@@ -168,6 +168,15 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
QmlEnginePrivate::~QmlEnginePrivate()
{
+ while (cleanup) {
+ QmlCleanup *c = cleanup;
+ cleanup = c->next;
+ if (cleanup) cleanup->prev = &cleanup;
+ c->next = 0;
+ c->prev = 0;
+ c->clear();
+ }
+
delete rootContext;
rootContext = 0;
delete contextClass;
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index bd1cab2..69b121e 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -97,6 +97,7 @@ class QmlTypeNameScriptClass;
class QmlTypeNameCache;
class QmlComponentAttached;
class QmlListScriptClass;
+class QmlCleanup;
class QmlEnginePrivate : public QObjectPrivate
{
@@ -139,6 +140,9 @@ public:
// Used by SQL database API
QScriptClass *sqlQueryClass;
+ // Registered cleanup handlers
+ QmlCleanup *cleanup;
+
struct QmlScriptEngine : public QScriptEngine
{
QmlScriptEngine(QmlEnginePrivate *priv)
diff --git a/src/declarative/qml/qmlintegercache.cpp b/src/declarative/qml/qmlintegercache.cpp
index 89a18a1..06955c7 100644
--- a/src/declarative/qml/qmlintegercache.cpp
+++ b/src/declarative/qml/qmlintegercache.cpp
@@ -46,13 +46,21 @@
QT_BEGIN_NAMESPACE
QmlIntegerCache::QmlIntegerCache(QmlEngine *e)
-: engine(e)
+: QmlCleanup(e), engine(e)
{
}
QmlIntegerCache::~QmlIntegerCache()
{
+ clear();
+}
+
+void QmlIntegerCache::clear()
+{
qDeleteAll(stringCache);
+ stringCache.clear();
+ identifierCache.clear();
+ engine = 0;
}
void QmlIntegerCache::add(const QString &id, int value)
diff --git a/src/declarative/qml/qmlintegercache_p.h b/src/declarative/qml/qmlintegercache_p.h
index e11e0be..6e9fadd 100644
--- a/src/declarative/qml/qmlintegercache_p.h
+++ b/src/declarative/qml/qmlintegercache_p.h
@@ -55,13 +55,14 @@
#include <private/qmlrefcount_p.h>
#include <private/qscriptdeclarativeclass_p.h>
+#include <private/qmlcleanup_p.h>
#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
class QmlType;
class QmlEngine;
-class QmlIntegerCache : public QmlRefCount
+class QmlIntegerCache : public QmlRefCount, public QmlCleanup
{
public:
QmlIntegerCache(QmlEngine *);
@@ -73,6 +74,10 @@ public:
inline int value(const QScriptDeclarativeClass::Identifier &id) const;
static QmlIntegerCache *createForEnums(QmlType *, QmlEngine *);
+
+protected:
+ virtual void clear();
+
private:
struct Data : public QScriptDeclarativeClass::PersistentIdentifier {
Data(const QScriptDeclarativeClass::PersistentIdentifier &i, int v)
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index baef71f..edec988 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QmlMetaProperty
\brief The QmlMetaProperty class abstracts accessing QML properties.
+ \internal
*/
/*!
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index e00126f..3ede341 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -86,12 +86,18 @@ void QmlPropertyCache::Data::load(const QMetaMethod &m)
}
-QmlPropertyCache::QmlPropertyCache()
+QmlPropertyCache::QmlPropertyCache(QmlEngine *engine)
+: QmlCleanup(engine)
{
}
QmlPropertyCache::~QmlPropertyCache()
{
+ clear();
+}
+
+void QmlPropertyCache::clear()
+{
for (int ii = 0; ii < indexCache.count(); ++ii)
indexCache.at(ii)->release();
@@ -102,6 +108,10 @@ QmlPropertyCache::~QmlPropertyCache()
for (IdentifierCache::ConstIterator iter = identifierCache.begin();
iter != identifierCache.end(); ++iter)
(*iter)->release();
+
+ indexCache.clear();
+ stringCache.clear();
+ identifierCache.clear();
}
QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject,
@@ -141,7 +151,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- QmlPropertyCache *cache = new QmlPropertyCache;
+ QmlPropertyCache *cache = new QmlPropertyCache(engine);
QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h
index 91b0c53..6c3142a 100644
--- a/src/declarative/qml/qmlpropertycache_p.h
+++ b/src/declarative/qml/qmlpropertycache_p.h
@@ -55,16 +55,17 @@
#include <private/qmlrefcount_p.h>
#include <private/qscriptdeclarativeclass_p.h>
+#include <private/qmlcleanup_p.h>
#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
class QmlEngine;
class QMetaProperty;
-class QmlPropertyCache : public QmlRefCount
+class QmlPropertyCache : public QmlRefCount, public QmlCleanup
{
public:
- QmlPropertyCache();
+ QmlPropertyCache(QmlEngine *);
virtual ~QmlPropertyCache();
struct Data {
@@ -112,6 +113,9 @@ public:
Data *property(const QString &) const;
Data *property(int) const;
+protected:
+ virtual void clear();
+
private:
struct RData : public Data, public QmlRefCount {
QScriptDeclarativeClass::PersistentIdentifier identifier;
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp b/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
index 86905e6..9a9aba8 100644
--- a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
+++ b/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
@@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QmlPropertyValueInterceptor
\brief The QmlPropertyValueInterceptor class is inherited by property interceptors such as Behavior.
+ \internal
This class intercepts property writes, allowing for custom handling. For example, Behavior uses this
interception to provide a default animation for all changes to a property's value.
diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qmlpropertyvaluesource.cpp
index 529ce37..3317289 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.cpp
+++ b/src/declarative/qml/qmlpropertyvaluesource.cpp
@@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QmlPropertyValueSource
\brief The QmlPropertyValueSource class is inherited by property value sources such as animations and bindings.
+ \internal
*/
/*!
diff --git a/src/declarative/qml/qmltypenamecache.cpp b/src/declarative/qml/qmltypenamecache.cpp
index aa1c938..d706c63 100644
--- a/src/declarative/qml/qmltypenamecache.cpp
+++ b/src/declarative/qml/qmltypenamecache.cpp
@@ -45,13 +45,21 @@
QT_BEGIN_NAMESPACE
QmlTypeNameCache::QmlTypeNameCache(QmlEngine *e)
-: engine(e)
+: QmlCleanup(e), engine(e)
{
}
QmlTypeNameCache::~QmlTypeNameCache()
{
+ clear();
+}
+
+void QmlTypeNameCache::clear()
+{
qDeleteAll(stringCache);
+ stringCache.clear();
+ identifierCache.clear();
+ engine = 0;
}
void QmlTypeNameCache::add(const QString &name, QmlType *type)
diff --git a/src/declarative/qml/qmltypenamecache_p.h b/src/declarative/qml/qmltypenamecache_p.h
index f11fe68..ec1e79d 100644
--- a/src/declarative/qml/qmltypenamecache_p.h
+++ b/src/declarative/qml/qmltypenamecache_p.h
@@ -55,12 +55,13 @@
#include <private/qmlrefcount_p.h>
#include <private/qscriptdeclarativeclass_p.h>
+#include <private/qmlcleanup_p.h>
QT_BEGIN_NAMESPACE
class QmlType;
class QmlEngine;
-class QmlTypeNameCache : public QmlRefCount
+class QmlTypeNameCache : public QmlRefCount, public QmlCleanup
{
public:
QmlTypeNameCache(QmlEngine *);
@@ -79,6 +80,9 @@ public:
Data *data(const QString &) const;
inline Data *data(const QScriptDeclarativeClass::Identifier &id) const;
+protected:
+ virtual void clear();
+
private:
struct RData : public Data {
QScriptDeclarativeClass::PersistentIdentifier identifier;
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 578646b..21007d6 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -136,7 +136,7 @@ QVariant QmlListAccessor::at(int idx) const
QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
void *ptr[1];
li->at(idx, ptr);
- return QmlMetaType::fromObject((QObject*)ptr[0], li->type()); //XXX only handles QObject-derived types
+ return QVariant::fromValue((QObject*)ptr[0]);
}
case QList:
return QmlMetaType::listAt(d, idx);
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index a112245..bed27fe 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -85,7 +85,8 @@ class QmlReplaceSignalHandler : public ActionEvent
public:
QmlReplaceSignalHandler() : expression(0), reverseExpression(0), ownedExpression(0) {}
~QmlReplaceSignalHandler() {
- delete ownedExpression;
+ if (ownedExpression)
+ delete ownedExpression;
}
virtual QString typeName() const { return QLatin1String("ReplaceSignalHandler"); }
@@ -93,7 +94,7 @@ public:
QmlMetaProperty property;
QmlExpression *expression;
QmlExpression *reverseExpression;
- QmlExpression *ownedExpression;
+ QGuard<QmlExpression> ownedExpression;
virtual void execute() {
ownedExpression = property.setSignalExpression(expression);
@@ -272,7 +273,6 @@ QmlPropertyChanges::~QmlPropertyChanges()
delete d->expressions.at(ii).second;
for(int ii = 0; ii < d->signalReplacements.count(); ++ii)
delete d->signalReplacements.at(ii);
-
}
QObject *QmlPropertyChanges::object() const
diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/canvasframerate.cpp
index 0d23050..7c5d089 100644
--- a/tools/qmldebugger/canvasframerate.cpp
+++ b/tools/qmldebugger/canvasframerate.cpp
@@ -32,7 +32,6 @@ public slots:
protected:
virtual void paintEvent(QPaintEvent *);
- virtual QSize sizeHint() const;
private slots:
void scrollbarChanged(int);
@@ -57,6 +56,8 @@ private:
QLineGraph::QLineGraph(QWidget *parent)
: QWidget(parent), sb(Qt::Horizontal, this), position(-1), samplesPerWidth(99), resolutionForHeight(50), ignoreScroll(false)
{
+ setMinimumHeight(180);
+
sb.setMaximum(0);
sb.setMinimum(0);
sb.setSingleStep(1);
@@ -68,11 +69,6 @@ QLineGraph::QLineGraph(QWidget *parent)
QObject::connect(&sb, SIGNAL(valueChanged(int)), this, SLOT(scrollbarChanged(int)));
}
-QSize QLineGraph::sizeHint() const
-{
- return QSize(800, 600);
-}
-
void QLineGraph::scrollbarChanged(int v)
{
if(ignoreScroll)
@@ -291,6 +287,16 @@ CanvasFrameRate::CanvasFrameRate(QmlDebugConnection *client, QWidget *parent)
newTab();
}
+void CanvasFrameRate::setSizeHint(const QSize &size)
+{
+ m_sizeHint = size;
+}
+
+QSize CanvasFrameRate::sizeHint() const
+{
+ return m_sizeHint;
+}
+
void CanvasFrameRate::newTab()
{
if (m_tabs->count()) {
diff --git a/tools/qmldebugger/canvasframerate.h b/tools/qmldebugger/canvasframerate.h
index cef267d..aa275aa 100644
--- a/tools/qmldebugger/canvasframerate.h
+++ b/tools/qmldebugger/canvasframerate.h
@@ -14,6 +14,9 @@ class CanvasFrameRate : public QWidget
public:
CanvasFrameRate(QmlDebugConnection *, QWidget *parent = 0);
+ void setSizeHint(const QSize &);
+ virtual QSize sizeHint() const;
+
private slots:
void newTab();
void stateChanged(int);
@@ -22,6 +25,7 @@ private:
QTabWidget *m_tabs;
QSpinBox *m_spin;
QObject *m_plugin;
+ QSize m_sizeHint;
};
QT_END_NAMESPACE
diff --git a/tools/qmldebugger/engine.cpp b/tools/qmldebugger/engine.cpp
index fac10f3..a1fd009 100644
--- a/tools/qmldebugger/engine.cpp
+++ b/tools/qmldebugger/engine.cpp
@@ -12,6 +12,7 @@
#include "engine.h"
#include "objectpropertiesview.h"
+#include "expressionquerywidget.h"
#include "objecttree.h"
#include "watchtable.h"
@@ -37,7 +38,7 @@ private:
};
EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent)
-: QWidget(parent), m_client(new QmlEngineDebug(conn, this)), m_engines(0), m_context(0), m_watchTableModel(0)
+: QWidget(parent), m_client(new QmlEngineDebug(conn, this)), m_engines(0), m_context(0), m_watchTableModel(0), m_exprQueryWidget(0)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
@@ -71,7 +72,7 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent)
WatchTableHeaderView *header = new WatchTableHeaderView(m_watchTableModel);
m_watchTableView->setHorizontalHeader(header);
- connect(m_objTree, SIGNAL(objectSelected(QmlDebugObjectReference)),
+ connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
m_propertiesView, SLOT(reload(QmlDebugObjectReference)));
connect(m_objTree, SIGNAL(expressionWatchRequested(QmlDebugObjectReference,QString)),
m_watchTableModel, SLOT(expressionWatchRequested(QmlDebugObjectReference,QString)));
@@ -83,10 +84,20 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent)
m_propertiesView, SLOT(watchCreated(QmlDebugWatch*)));
connect(m_watchTableView, SIGNAL(objectActivated(int)),
- m_objTree, SLOT(selectObject(int)));
-
+ m_objTree, SLOT(setCurrentObject(int)));
+
+ m_exprQueryWidget = new ExpressionQueryWidget(m_client);
+ connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
+ m_exprQueryWidget, SLOT(setCurrentObject(QmlDebugObjectReference)));
+
+ QSplitter *propertiesTab = new QSplitter(Qt::Vertical);
+ propertiesTab->addWidget(m_propertiesView);
+ propertiesTab->addWidget(m_exprQueryWidget);
+ propertiesTab->setStretchFactor(0, 2);
+ propertiesTab->setStretchFactor(1, 1);
+
m_tabs = new QTabWidget(this);
- m_tabs->addTab(m_propertiesView, tr("Properties"));
+ m_tabs->addTab(propertiesTab, tr("Properties"));
m_tabs->addTab(m_watchTableView, tr("Watched"));
splitter->addWidget(m_objTree);
diff --git a/tools/qmldebugger/engine.h b/tools/qmldebugger/engine.h
index 8e8c0f2..a3ebe46 100644
--- a/tools/qmldebugger/engine.h
+++ b/tools/qmldebugger/engine.h
@@ -17,6 +17,7 @@ class QmlDebugWatch;
class ObjectTree;
class WatchTableModel;
class WatchTableView;
+class ExpressionQueryWidget;
class QTabWidget;
@@ -45,12 +46,12 @@ private:
ObjectTree *m_objTree;
QTabWidget *m_tabs;
WatchTableView *m_watchTableView;
+ WatchTableModel *m_watchTableModel;
+ ExpressionQueryWidget *m_exprQueryWidget;
QmlView *m_engineView;
QList<QObject *> m_engineItems;
- WatchTableModel *m_watchTableModel;
-
ObjectPropertiesView *m_propertiesView;
};
diff --git a/tools/qmldebugger/expressionquerywidget.cpp b/tools/qmldebugger/expressionquerywidget.cpp
index b29b465..53ede3a 100644
--- a/tools/qmldebugger/expressionquerywidget.cpp
+++ b/tools/qmldebugger/expressionquerywidget.cpp
@@ -1,3 +1,5 @@
+#include <QtCore/qdebug.h>
+
#include <QtGui/qlabel.h>
#include <QtGui/qtextedit.h>
#include <QtGui/qlineedit.h>
@@ -14,25 +16,21 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa
m_style(Compact),
m_client(client),
m_query(0),
- m_groupBox(0),
m_textEdit(new QTextEdit),
m_lineEdit(0),
m_button(0)
{
m_prompt = QLatin1String(">> ");
- m_groupBox = new QGroupBox;
- QVBoxLayout *vbox = new QVBoxLayout(m_groupBox);
- vbox->addWidget(m_textEdit);
-
QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(m_groupBox);
+ layout->setMargin(0);
+ layout->addWidget(m_textEdit);
updateTitle();
if (m_style == Compact) {
QHBoxLayout *hbox = new QHBoxLayout;
- m_button = new QPushButton(tr("Execute"));
+ m_button = new QPushButton(tr("Query"));
m_button->setEnabled(false);
connect(m_button, SIGNAL(clicked()), SLOT(executeExpression()));
m_lineEdit = new QLineEdit;
@@ -41,7 +39,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa
hbox->addWidget(new QLabel(tr("Expression:")));
hbox->addWidget(m_lineEdit);
hbox->addWidget(m_button);
- vbox->addLayout(hbox);
+ layout->addLayout(hbox);
m_textEdit->setReadOnly(true);
m_lineEdit->installEventFilter(this);
@@ -50,17 +48,21 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa
}
}
+void ExpressionQueryWidget::setEngineDebug(QmlEngineDebug *client)
+{
+ m_client = client;
+}
+
void ExpressionQueryWidget::updateTitle()
{
if (m_currObject.debugId() < 0) {
- m_groupBox->setTitle(tr("Expression queries"));
+ m_title = tr("Expression queries");
} else {
QString desc = QLatin1String("<")
+ m_currObject.className() + QLatin1String(": ")
+ (m_currObject.name().isEmpty() ? QLatin1String("<unnamed>") : m_currObject.name())
+ QLatin1String(">");
- m_groupBox->setTitle(tr("Expression queries (using context for %1)"
- , "Selected object").arg(desc));
+ m_title = tr("Expression queries (using context for %1)" , "Selected object").arg(desc);
}
}
@@ -103,6 +105,9 @@ void ExpressionQueryWidget::showCurrentContext()
void ExpressionQueryWidget::executeExpression()
{
+ if (!m_client)
+ return;
+
if (m_style == Compact)
m_expr = m_lineEdit->text().trimmed();
else
diff --git a/tools/qmldebugger/expressionquerywidget.h b/tools/qmldebugger/expressionquerywidget.h
index 8db8f9f..3d9b580 100644
--- a/tools/qmldebugger/expressionquerywidget.h
+++ b/tools/qmldebugger/expressionquerywidget.h
@@ -21,7 +21,9 @@ public:
Shell
};
- ExpressionQueryWidget(QmlEngineDebug *client, QWidget *parent = 0);
+ ExpressionQueryWidget(QmlEngineDebug *client = 0, QWidget *parent = 0);
+
+ void setEngineDebug(QmlEngineDebug *client);
protected:
bool eventFilter(QObject *obj, QEvent *event);
@@ -44,7 +46,6 @@ private:
QmlEngineDebug *m_client;
QmlDebugExpressionQuery *m_query;
- QGroupBox *m_groupBox;
QTextEdit *m_textEdit;
QLineEdit *m_lineEdit;
QPushButton *m_button;
@@ -52,6 +53,8 @@ private:
QString m_expr;
QString m_lastExpr;
+ QString m_title;
+
QmlDebugObjectReference m_currObject;
QmlDebugObjectReference m_objectAtLastFocus;
};
diff --git a/tools/qmldebugger/objectpropertiesview.cpp b/tools/qmldebugger/objectpropertiesview.cpp
index 61afe3f..274552a 100644
--- a/tools/qmldebugger/objectpropertiesview.cpp
+++ b/tools/qmldebugger/objectpropertiesview.cpp
@@ -53,8 +53,15 @@ ObjectPropertiesView::ObjectPropertiesView(QmlEngineDebug *client, QWidget *pare
layout->addWidget(m_tree);
}
+void ObjectPropertiesView::setEngineDebug(QmlEngineDebug *client)
+{
+ m_client = client;
+}
+
void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj)
{
+ if (!m_client)
+ return;
if (m_query)
delete m_query;
@@ -68,7 +75,7 @@ void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj)
void ObjectPropertiesView::queryFinished()
{
- if (!m_query)
+ if (!m_client || !m_query)
return;
QmlDebugObjectReference obj = m_query->object();
diff --git a/tools/qmldebugger/objectpropertiesview.h b/tools/qmldebugger/objectpropertiesview.h
index 0f72ff4..d555940 100644
--- a/tools/qmldebugger/objectpropertiesview.h
+++ b/tools/qmldebugger/objectpropertiesview.h
@@ -9,13 +9,16 @@ QT_BEGIN_NAMESPACE
class QTreeWidget;
class QTreeWidgetItem;
+class QmlDebugConnection;
class ObjectPropertiesView : public QWidget
{
Q_OBJECT
public:
- ObjectPropertiesView(QmlEngineDebug *client, QWidget *parent = 0);
+ ObjectPropertiesView(QmlEngineDebug *client = 0, QWidget *parent = 0);
+ void setEngineDebug(QmlEngineDebug *client);
+
signals:
void activated(const QmlDebugObjectReference &, const QmlDebugPropertyReference &);
diff --git a/tools/qmldebugger/objecttree.cpp b/tools/qmldebugger/objecttree.cpp
index 0b92ceb..981a80b 100644
--- a/tools/qmldebugger/objecttree.cpp
+++ b/tools/qmldebugger/objecttree.cpp
@@ -18,13 +18,22 @@ ObjectTree::ObjectTree(QmlEngineDebug *client, QWidget *parent)
m_query(0)
{
setHeaderHidden(true);
+ setMinimumWidth(250);
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(currentItemChanged(QTreeWidgetItem *)));
}
+void ObjectTree::setEngineDebug(QmlEngineDebug *client)
+{
+ m_client = client;
+}
+
void ObjectTree::reload(int objectDebugId)
{
+ if (!m_client)
+ return;
+
if (m_query) {
delete m_query;
m_query = 0;
diff --git a/tools/qmldebugger/objecttree.h b/tools/qmldebugger/objecttree.h
index 3c0a5c6..95820f3 100644
--- a/tools/qmldebugger/objecttree.h
+++ b/tools/qmldebugger/objecttree.h
@@ -11,14 +11,17 @@ class QmlEngineDebug;
class QmlDebugObjectReference;
class QmlDebugObjectQuery;
class QmlDebugContextReference;
+class QmlDebugConnection;
class ObjectTree : public QTreeWidget
{
Q_OBJECT
public:
- ObjectTree(QmlEngineDebug *client, QWidget *parent = 0);
+ ObjectTree(QmlEngineDebug *client = 0, QWidget *parent = 0);
+ void setEngineDebug(QmlEngineDebug *client);
+
signals:
void currentObjectChanged(const QmlDebugObjectReference &);
void expressionWatchRequested(const QmlDebugObjectReference &, const QString &);
diff --git a/tools/qmldebugger/qmldebugger.cpp b/tools/qmldebugger/qmldebugger.cpp
index e0a76b6..2828026 100644
--- a/tools/qmldebugger/qmldebugger.cpp
+++ b/tools/qmldebugger/qmldebugger.cpp
@@ -46,6 +46,7 @@ QmlDebugger::QmlDebugger(QWidget *parent)
layout->addWidget(m_tabs);
CanvasFrameRate *cfr = new CanvasFrameRate(&client, this);
+ cfr->setSizeHint(QSize(800, 600));
m_tabs->addTab(cfr, tr("Frame Rate"));
m_enginePane = new EnginePane(&client, this);
diff --git a/tools/qmldebugger/watchtable.cpp b/tools/qmldebugger/watchtable.cpp
index 512bfb2..774727b 100644
--- a/tools/qmldebugger/watchtable.cpp
+++ b/tools/qmldebugger/watchtable.cpp
@@ -23,6 +23,11 @@ WatchTableModel::~WatchTableModel()
delete m_columns[i].watch;
}
+void WatchTableModel::setEngineDebug(QmlEngineDebug *client)
+{
+ m_client = client;
+}
+
void WatchTableModel::addWatch(QmlDebugWatch *watch, const QString &title)
{
QString property;
@@ -193,7 +198,7 @@ void WatchTableModel::addValue(int column, const QVariant &value)
void WatchTableModel::togglePropertyWatch(const QmlDebugObjectReference &object, const QmlDebugPropertyReference &property)
{
- if (!property.hasNotifySignal())
+ if (!m_client || !property.hasNotifySignal())
return;
QmlDebugWatch *watch = findWatch(object.debugId(), property.name());
@@ -228,6 +233,9 @@ void WatchTableModel::watchedValueChanged(const QByteArray &propertyName, const
void WatchTableModel::expressionWatchRequested(const QmlDebugObjectReference &obj, const QString &expr)
{
+ if (!m_client)
+ return;
+
QmlDebugWatch *watch = m_client->addWatch(obj, expr, this);
if (watch->state() == QmlDebugWatch::Dead) {
@@ -241,6 +249,9 @@ void WatchTableModel::expressionWatchRequested(const QmlDebugObjectReference &ob
void WatchTableModel::stopWatching(int column)
{
+ if (!m_client)
+ return;
+
QmlDebugWatch *watch = findWatch(column);
if (watch) {
m_client->removeWatch(watch);
diff --git a/tools/qmldebugger/watchtable.h b/tools/qmldebugger/watchtable.h
index abada2b..772142c 100644
--- a/tools/qmldebugger/watchtable.h
+++ b/tools/qmldebugger/watchtable.h
@@ -13,6 +13,7 @@ QT_BEGIN_NAMESPACE
class QmlDebugWatch;
class QmlEngineDebug;
+class QmlDebugConnection;
class QmlDebugPropertyReference;
class QmlDebugObjectReference;
@@ -20,9 +21,11 @@ class WatchTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
- WatchTableModel(QmlEngineDebug *client, QObject *parent = 0);
+ WatchTableModel(QmlEngineDebug *client = 0, QObject *parent = 0);
~WatchTableModel();
+ void setEngineDebug(QmlEngineDebug *client);
+
QmlDebugWatch *findWatch(int column) const;
int columnForWatch(QmlDebugWatch *watch) const;