summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-10 02:11:27 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-10 02:11:27 (GMT)
commit4983b04da9f3258519e4b15f8e593bf2a11f3556 (patch)
treefc1c7e6b8578268e45a8bbf12ba08c2c2f12ae78 /src
parentcdabdb79808b3788519fa3bde0d240f2b11a4b34 (diff)
parent8d930f43d6e0827ece00b61676b736421b50f290 (diff)
downloadQt-4983b04da9f3258519e4b15f8e593bf2a11f3556.zip
Qt-4983b04da9f3258519e4b15f8e593bf2a11f3556.tar.gz
Qt-4983b04da9f3258519e4b15f8e593bf2a11f3556.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem_p.h18
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners.cpp138
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h26
-rw-r--r--src/declarative/util/qmlstateoperations.cpp12
-rw-r--r--src/declarative/util/qmlstateoperations_p.h2
5 files changed, 98 insertions, 98 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem_p.h b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
index f98c121..e1d7342 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
@@ -232,6 +232,24 @@ public:
emit q_func()->wantsFocusChanged();
}
+ // Reimplemented from QGraphicsItemPrivate
+ virtual void siblingOrderChange()
+ {
+ foreach(QmlGraphicsItemPrivate* other, siblingOrderNotifiees)
+ other->otherSiblingOrderChange(this);
+ }
+ QList<QmlGraphicsItemPrivate*> siblingOrderNotifiees;
+ void registerSiblingOrderNotification(QmlGraphicsItemPrivate* other)
+ {
+ siblingOrderNotifiees << other;
+ }
+ void unregisterSiblingOrderNotification(QmlGraphicsItemPrivate* other)
+ {
+ siblingOrderNotifiees.removeAll(other);
+ }
+ virtual void otherSiblingOrderChange(QmlGraphicsItemPrivate* other) {Q_UNUSED(other)}
+
+
static int consistentTime;
static QTime currentTime();
static void Q_DECLARATIVE_EXPORT setConsistentTime(int t);
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
index 3b975ba..cbb4b13 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
@@ -52,6 +52,36 @@
QT_BEGIN_NAMESPACE
+void QmlGraphicsBasePositionerPrivate::watchChanges(QmlGraphicsItem *other)
+{
+ Q_Q(QmlGraphicsBasePositioner);
+ QObject::connect(other, SIGNAL(visibleChanged()),
+ q, SLOT(prePositioning()));
+ QObject::connect(other, SIGNAL(opacityChanged()),
+ q, SLOT(prePositioning()));
+ QObject::connect(other, SIGNAL(heightChanged()),
+ q, SLOT(prePositioning()));
+ QObject::connect(other, SIGNAL(widthChanged()),
+ q, SLOT(prePositioning()));
+ static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(other))->registerSiblingOrderNotification(this);
+ watched << other;
+}
+
+void QmlGraphicsBasePositionerPrivate::unwatchChanges(QmlGraphicsItem* other)
+{
+ Q_Q(QmlGraphicsBasePositioner);
+ QObject::disconnect(other, SIGNAL(visibleChanged()),
+ q, SLOT(prePositioning()));
+ QObject::disconnect(other, SIGNAL(opacityChanged()),
+ q, SLOT(prePositioning()));
+ QObject::disconnect(other, SIGNAL(heightChanged()),
+ q, SLOT(prePositioning()));
+ QObject::disconnect(other, SIGNAL(widthChanged()),
+ q, SLOT(prePositioning()));
+ static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(other))->unregisterSiblingOrderNotification(this);
+ watched.removeAll(other);
+}
+
/*!
\internal
\class QmlGraphicsBasePositioner
@@ -204,6 +234,7 @@ void QmlGraphicsBasePositioner::prePositioning()
if (!isComponentComplete() || d->_movingItem)
return;
+ d->queuedPositioning = false;
if (!d->_ep) {
d->_ep = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
@@ -220,14 +251,7 @@ void QmlGraphicsBasePositioner::prePositioning()
if (!child)
continue;
if (!d->_items.contains(child)){
- QObject::connect(child, SIGNAL(visibleChanged()),
- this, SLOT(prePositioning()));
- QObject::connect(child, SIGNAL(opacityChanged()),
- this, SLOT(prePositioning()));
- QObject::connect(child, SIGNAL(heightChanged()),
- this, SLOT(prePositioning()));
- QObject::connect(child, SIGNAL(widthChanged()),
- this, SLOT(prePositioning()));
+ d->watchChanges(child);
d->_items += child;
}
if (child->opacity() == 0.0){
@@ -390,58 +414,24 @@ Column {
/*!
\qmlproperty Transition Column::remove
This property holds the transition to apply when removing an item from the positioner. The transition is only applied to the removed items.
+ Positioner transitions will only affect the position (x,y) of items.
Removed can mean that either the object has been deleted or reparented, and thus is now longer a child of the positioner, or that the object has had its opacity set to zero, and thus is no longer visible.
- Note that if the item counts as removed because its opacity is zero it will not be visible during the transition unless you set the opacity in the transition, like in the below example.
-
- \table
- \row
- \o \image positioner-remove.gif
- \o
- \qml
-Column {
- remove: Transition {
- NumberAnimation {
- properties: "opacity"
- from: 1
- to: 0
- duration: 500
- }
- }
-}
- \endqml
- \endtable
-
*/
/*!
\qmlproperty Transition Column::add
This property holds the transition to be applied when adding an item to the positioner. The transition will only be applied to the added item(s).
+ Positioner transitions will only affect the position (x,y) of items.
Added can mean that either the object has been created or reparented, and thus is now a child or the positioner, or that the object has had its opacity increased from zero, and thus is now visible.
- \table
- \row
- \o \image positioner-add.gif
- \o
- \qml
-Column {
- add: Transition {
- NumberAnimation {
- properties: "opacity"
- from: 0
- to: 1
- duration: 500
- }
- }
-}
- \endqml
- \endtable
*/
/*!
\qmlproperty Transition Column::move
This property holds the transition to apply when moving an item within the positioner.
+ Positioner transitions will only affect the position (x,y) of items.
This can happen when other items are added or removed from the positioner, or when items resize themselves.
@@ -564,49 +554,28 @@ Row {
\qmlproperty Transition Row::remove
This property holds the transition to apply when removing an item from the positioner.
The transition will only be applied to the removed item(s).
+ Positioner transitions will only affect the position (x,y) of items.
Removed can mean that either the object has been deleted or reparented, and thus is now longer a child of the positioner, or that the object has had its opacity set to zero, and thus is no longer visible.
Note that if the item counts as removed because its opacity is zero it will not be visible during the transition unless you set the opacity in the transition, like in the below example.
- \qml
-Row {
- remove: Transition {
- NumberAnimation {
- properties: "opacity"
- from: 1
- to: 0
- duration: 500
- }
- }
-}
- \endqml
*/
/*!
\qmlproperty Transition Row::add
This property holds the transition to apply when adding an item to the positioner.
The transition will only be applied to the added item(s).
+ Positioner transitions will only affect the position (x,y) of items.
Added can mean that either the object has been created or reparented, and thus is now a child or the positioner, or that the object has had its opacity increased from zero, and thus is now visible.
- \qml
-Row {
- add: Transition {
- NumberAnimation {
- properties: "opacity"
- from: 0
- to: 1
- duration: 500
- }
- }
-}
- \endqml
*/
/*!
\qmlproperty Transition Row::move
This property holds the transition to apply when moving an item within the positioner.
+ Positioner transitions will only affect the position (x,y) of items.
This can happen when other items are added or removed from the positioner, or when items resize themselves.
@@ -735,57 +704,32 @@ Grid {
\qmlproperty Transition Grid::remove
This property holds the transition to apply when removing an item from the positioner.
The transition is only applied to the removed item(s).
+ Positioner transitions will only affect the position (x,y) of items.
Removed can mean that either the object has been deleted or
reparented, and thus is now longer a child of the positioner, or that
the object has had its opacity set to zero, and thus is no longer
visible.
- Note that if the item counts as removed because its opacity is
- zero it will not be visible during the transition unless you set
- the opacity in the transition, like in the below example.
-
- \qml
-Grid {
- remove: Transition {
- NumberAnimation {
- properties: "opacity"
- from: 1
- to: 0
- duration: 500
- }
- }
-}
- \endqml
*/
/*!
\qmlproperty Transition Grid::add
This property holds the transition to apply when adding an item to the positioner.
The transition is only applied to the added item(s).
+ Positioner transitions will only affect the position (x,y) of items.
Added can mean that either the object has been created or
reparented, and thus is now a child or the positioner, or that the
object has had its opacity increased from zero, and thus is now
visible.
- \qml
-Grid {
- add: Transition {
- NumberAnimation {
- properties: "opacity"
- from: 0
- to: 1
- duration: 500
- }
- }
-}
- \endqml
*/
/*!
\qmlproperty Transition Grid::move
This property holds the transition to apply when moving an item within the positioner.
+ Positioner transitions will only affect the position (x,y) of items.
This can happen when other items are added or removed from the positioner, or
when items resize themselves.
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h b/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
index 61b4497..d7a31a3 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
@@ -60,6 +60,7 @@
#include <private/qmlstate_p.h>
#include <private/qmltransitionmanager_p_p.h>
#include <private/qmlstateoperations_p.h>
+#include <QtCore/QTimer>
QT_BEGIN_NAMESPACE
class QmlGraphicsBasePositionerPrivate : public QmlGraphicsItemPrivate
@@ -70,10 +71,17 @@ public:
QmlGraphicsBasePositionerPrivate()
: _ep(false), _componentComplete(false), _spacing(0),
aut(QmlGraphicsBasePositioner::None), moveTransition(0), addTransition(0),
- removeTransition(0), _movingItem(0)
+ removeTransition(0), _movingItem(0), queuedPositioning(false)
{
}
+ ~QmlGraphicsBasePositionerPrivate()
+ {
+ watched.removeAll(0);
+ foreach(QmlGraphicsItem* other, watched)
+ unwatchChanges(other);//Need to deregister from a list in QmlGI Private
+ }
+
void init(QmlGraphicsBasePositioner::AutoUpdateType at)
{
aut = at;
@@ -99,6 +107,22 @@ public:
QmlTransitionManager removeTransitionManager;
// QmlStateGroup *stateGroup;
QmlGraphicsItem *_movingItem;
+
+ void watchChanges(QmlGraphicsItem *other);
+ void unwatchChanges(QmlGraphicsItem* other);
+ QList<QGuard<QmlGraphicsItem> > watched;
+ bool queuedPositioning;
+
+ virtual void otherSiblingOrderChange(QmlGraphicsItemPrivate* other)
+ {
+ Q_Q(QmlGraphicsBasePositioner);
+ Q_UNUSED(other);
+ if(!queuedPositioning){
+ //Delay is due to many children often being reordered at once
+ QTimer::singleShot(0,q,SLOT(prePositioning()));
+ queuedPositioning = true;
+ }
+ }
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 1b786d2..2fca002 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -319,6 +319,13 @@ void QmlStateChangeScript::setScript(const QmlScriptString &s)
d->script = s;
}
+/*!
+ \qmlproperty script StateChangeScript::script
+ This property holds the name of the script. This name can be used by a
+ ScriptAction to target a specific script.
+
+ \sa ScriptAction::stateChangeScriptName
+*/
QString QmlStateChangeScript::name() const
{
Q_D(const QmlStateChangeScript);
@@ -351,6 +358,11 @@ QmlStateChangeScript::ActionList QmlStateChangeScript::actions()
return rv;
}
+QString QmlStateChangeScript::typeName() const
+{
+ return QLatin1String("StateChangeScript");
+}
+
/*!
\qmlclass AnchorChanges QmlAnchorChanges
\brief The AnchorChanges element allows you to change the anchors of an item in a state.
diff --git a/src/declarative/util/qmlstateoperations_p.h b/src/declarative/util/qmlstateoperations_p.h
index 2801f2b..861e4d0 100644
--- a/src/declarative/util/qmlstateoperations_p.h
+++ b/src/declarative/util/qmlstateoperations_p.h
@@ -96,6 +96,8 @@ public:
virtual ActionList actions();
+ virtual QString typeName() const;
+
QmlScriptString script() const;
void setScript(const QmlScriptString &);