summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-31 07:46:34 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-31 07:46:34 (GMT)
commite93d11c733bb44208089a7488c6e7a176468d407 (patch)
tree8ca16ca3cd5dc90ed1980ff27409feb381daa69c /src
parentbeecb594267063a877e844538c15f67339bf6a8e (diff)
parent0b98430c19a613fa660133b37c83e1abd3d8d1a5 (diff)
downloadQt-e93d11c733bb44208089a7488c6e7a176468d407.zip
Qt-e93d11c733bb44208089a7488c6e7a176468d407.tar.gz
Qt-e93d11c733bb44208089a7488c6e7a176468d407.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Add missing image Mention scope of id uniqueness Update QML Documents example add license header doc: Add a note about QCoreApplication::applicationDirPath Add license header Add moving and flicking properties to PathView Improve utility of QMLViewer Add missing \l doc commands Document elements that are focus scopes. Remove use of shared NOTIFY signals in QGraphicsScale Remove use of shared NOTIFY signals
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp24
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h19
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp14
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h7
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp9
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p.h41
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp115
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p.h13
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h13
-rw-r--r--src/declarative/graphicsitems/qdeclarativetranslate.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetranslate_p.h7
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp8
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h10
-rw-r--r--src/gui/graphicsview/qgraphicstransform.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicstransform.h9
17 files changed, 241 insertions, 66 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 89b3958..f02ef6b 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1085,13 +1085,15 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
\c portrait data directly.
An improved grid view is shown below. The delegate is visually improved and is moved
- into a separate \c contactDelegate component. Also, the currently selected item is highlighted
- with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true
- to enable keyboard navigation for the grid view.
+ into a separate \c contactDelegate component.
\snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs advanced
\image gridview-highlight.png
+ The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
+ and \c focus is set to \c true to enable keyboard navigation for the grid view.
+ The grid view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index c80fc2f..2c295cd 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -511,8 +511,10 @@ QDeclarativeItem *QDeclarativeKeyNavigationAttached::left() const
void QDeclarativeKeyNavigationAttached::setLeft(QDeclarativeItem *i)
{
Q_D(QDeclarativeKeyNavigationAttached);
+ if (d->left == i)
+ return;
d->left = i;
- emit changed();
+ emit leftChanged();
}
QDeclarativeItem *QDeclarativeKeyNavigationAttached::right() const
@@ -524,8 +526,10 @@ QDeclarativeItem *QDeclarativeKeyNavigationAttached::right() const
void QDeclarativeKeyNavigationAttached::setRight(QDeclarativeItem *i)
{
Q_D(QDeclarativeKeyNavigationAttached);
+ if (d->right == i)
+ return;
d->right = i;
- emit changed();
+ emit rightChanged();
}
QDeclarativeItem *QDeclarativeKeyNavigationAttached::up() const
@@ -537,8 +541,10 @@ QDeclarativeItem *QDeclarativeKeyNavigationAttached::up() const
void QDeclarativeKeyNavigationAttached::setUp(QDeclarativeItem *i)
{
Q_D(QDeclarativeKeyNavigationAttached);
+ if (d->up == i)
+ return;
d->up = i;
- emit changed();
+ emit upChanged();
}
QDeclarativeItem *QDeclarativeKeyNavigationAttached::down() const
@@ -550,8 +556,10 @@ QDeclarativeItem *QDeclarativeKeyNavigationAttached::down() const
void QDeclarativeKeyNavigationAttached::setDown(QDeclarativeItem *i)
{
Q_D(QDeclarativeKeyNavigationAttached);
+ if (d->down == i)
+ return;
d->down = i;
- emit changed();
+ emit downChanged();
}
QDeclarativeItem *QDeclarativeKeyNavigationAttached::tab() const
@@ -563,8 +571,10 @@ QDeclarativeItem *QDeclarativeKeyNavigationAttached::tab() const
void QDeclarativeKeyNavigationAttached::setTab(QDeclarativeItem *i)
{
Q_D(QDeclarativeKeyNavigationAttached);
+ if (d->tab == i)
+ return;
d->tab = i;
- emit changed();
+ emit tabChanged();
}
QDeclarativeItem *QDeclarativeKeyNavigationAttached::backtab() const
@@ -576,8 +586,10 @@ QDeclarativeItem *QDeclarativeKeyNavigationAttached::backtab() const
void QDeclarativeKeyNavigationAttached::setBacktab(QDeclarativeItem *i)
{
Q_D(QDeclarativeKeyNavigationAttached);
+ if (d->backtab == i)
+ return;
d->backtab = i;
- emit changed();
+ emit backtabChanged();
}
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 8c3e084..fffb4f7 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -363,12 +363,12 @@ class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeIte
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeKeyNavigationAttached)
- Q_PROPERTY(QDeclarativeItem *left READ left WRITE setLeft NOTIFY changed)
- Q_PROPERTY(QDeclarativeItem *right READ right WRITE setRight NOTIFY changed)
- Q_PROPERTY(QDeclarativeItem *up READ up WRITE setUp NOTIFY changed)
- Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY changed)
- Q_PROPERTY(QDeclarativeItem *tab READ tab WRITE setTab NOTIFY changed)
- Q_PROPERTY(QDeclarativeItem *backtab READ backtab WRITE setBacktab NOTIFY changed)
+ Q_PROPERTY(QDeclarativeItem *left READ left WRITE setLeft NOTIFY leftChanged)
+ Q_PROPERTY(QDeclarativeItem *right READ right WRITE setRight NOTIFY rightChanged)
+ Q_PROPERTY(QDeclarativeItem *up READ up WRITE setUp NOTIFY upChanged)
+ Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY downChanged)
+ Q_PROPERTY(QDeclarativeItem *tab READ tab WRITE setTab NOTIFY tabChanged)
+ Q_PROPERTY(QDeclarativeItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged)
Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
Q_ENUMS(Priority)
@@ -396,7 +396,12 @@ public:
static QDeclarativeKeyNavigationAttached *qmlAttachedProperties(QObject *);
Q_SIGNALS:
- void changed();
+ void leftChanged();
+ void rightChanged();
+ void upChanged();
+ void downChanged();
+ void tabChanged();
+ void backtabChanged();
void priorityChanged();
private:
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 8b616ce..b0a11b9 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -60,7 +60,7 @@ void QDeclarativeViewSection::setProperty(const QString &property)
{
if (property != m_property) {
m_property = property;
- emit changed();
+ emit propertyChanged();
}
}
@@ -68,7 +68,7 @@ void QDeclarativeViewSection::setCriteria(QDeclarativeViewSection::SectionCriter
{
if (criteria != m_criteria) {
m_criteria = criteria;
- emit changed();
+ emit criteriaChanged();
}
}
@@ -1385,14 +1385,16 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
the delegate is able to access the model's \c name and \c number data directly.
An improved list view is shown below. The delegate is visually improved and is moved
- into a separate \c contactDelegate component. Also, the currently selected item is highlighted
- with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true
- to enable keyboard navigation for the list view.
+ into a separate \c contactDelegate component.
\snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced
\image listview-highlight.png
- In a GridView, delegates are instantiated as needed and may be destroyed at any time.
+ The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
+ and \c focus is set to \c true to enable keyboard navigation for the list view.
+ The list view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
+ Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
\note Views do not enable \e clip automatically. If the view
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index 9941040..b264861 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -53,8 +53,8 @@ QT_MODULE(Declarative)
class Q_AUTOTEST_EXPORT QDeclarativeViewSection : public QObject
{
Q_OBJECT
- Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed)
- Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY changed)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
+ Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY criteriaChanged)
Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_ENUMS(SectionCriteria)
public:
@@ -73,7 +73,8 @@ public:
QString sectionString(const QString &value);
Q_SIGNALS:
- void changed();
+ void propertyChanged();
+ void criteriaChanged();
void delegateChanged();
private:
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index cc7f8e5..d28181e 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -159,6 +159,9 @@ void QDeclarativeLoaderPrivate::initResize()
unloads "Page1.qml" and frees resources consumed by it.
+ Note that Loader is a focus scope. Its \c focus property must be set to \c true for any of its children
+ to get the \e {active focus} (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
\sa {dynamic-object-creation}{Dynamic Object Creation}
*/
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index 80196a1..c48011d3 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -474,6 +474,7 @@ void QDeclarativeCurve::setX(qreal x)
{
if (_x != x) {
_x = x;
+ emit xChanged();
emit changed();
}
}
@@ -487,6 +488,7 @@ void QDeclarativeCurve::setY(qreal y)
{
if (_y != y) {
_y = y;
+ emit yChanged();
emit changed();
}
}
@@ -576,6 +578,7 @@ void QDeclarativePathAttribute::setValue(qreal value)
{
if (_value != value) {
_value = value;
+ emit valueChanged();
emit changed();
}
}
@@ -678,6 +681,7 @@ void QDeclarativePathQuad::setControlX(qreal x)
{
if (_controlX != x) {
_controlX = x;
+ emit controlXChanged();
emit changed();
}
}
@@ -695,6 +699,7 @@ void QDeclarativePathQuad::setControlY(qreal y)
{
if (_controlY != y) {
_controlY = y;
+ emit controlYChanged();
emit changed();
}
}
@@ -761,6 +766,7 @@ void QDeclarativePathCubic::setControl1X(qreal x)
{
if (_control1X != x) {
_control1X = x;
+ emit control1XChanged();
emit changed();
}
}
@@ -774,6 +780,7 @@ void QDeclarativePathCubic::setControl1Y(qreal y)
{
if (_control1Y != y) {
_control1Y = y;
+ emit control1YChanged();
emit changed();
}
}
@@ -793,6 +800,7 @@ void QDeclarativePathCubic::setControl2X(qreal x)
{
if (_control2X != x) {
_control2X = x;
+ emit control2XChanged();
emit changed();
}
}
@@ -806,6 +814,7 @@ void QDeclarativePathCubic::setControl2Y(qreal y)
{
if (_control2Y != y) {
_control2Y = y;
+ emit control2YChanged();
emit changed();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h
index 001bcdf..5ab5cfd 100644
--- a/src/declarative/graphicsitems/qdeclarativepath_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p.h
@@ -68,7 +68,7 @@ class Q_AUTOTEST_EXPORT QDeclarativePathAttribute : public QDeclarativePathEleme
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed)
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged)
public:
QDeclarativePathAttribute(QObject *parent=0) : QDeclarativePathElement(parent), _value(0) {}
@@ -81,6 +81,7 @@ public:
Q_SIGNALS:
void nameChanged();
+ void valueChanged();
private:
QString _name;
@@ -91,8 +92,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeCurve : public QDeclarativePathElement
{
Q_OBJECT
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY changed)
- Q_PROPERTY(qreal y READ y WRITE setY NOTIFY changed)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
public:
QDeclarativeCurve(QObject *parent=0) : QDeclarativePathElement(parent), _x(0), _y(0) {}
@@ -104,6 +105,10 @@ public:
virtual void addToPath(QPainterPath &) {}
+Q_SIGNALS:
+ void xChanged();
+ void yChanged();
+
private:
qreal _x;
qreal _y;
@@ -122,8 +127,8 @@ class Q_AUTOTEST_EXPORT QDeclarativePathQuad : public QDeclarativeCurve
{
Q_OBJECT
- Q_PROPERTY(qreal controlX READ controlX WRITE setControlX NOTIFY changed)
- Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY changed)
+ Q_PROPERTY(qreal controlX READ controlX WRITE setControlX NOTIFY controlXChanged)
+ Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY controlYChanged)
public:
QDeclarativePathQuad(QObject *parent=0) : QDeclarativeCurve(parent), _controlX(0), _controlY(0) {}
@@ -135,6 +140,10 @@ public:
void addToPath(QPainterPath &path);
+Q_SIGNALS:
+ void controlXChanged();
+ void controlYChanged();
+
private:
qreal _controlX;
qreal _controlY;
@@ -144,10 +153,10 @@ class Q_AUTOTEST_EXPORT QDeclarativePathCubic : public QDeclarativeCurve
{
Q_OBJECT
- Q_PROPERTY(qreal control1X READ control1X WRITE setControl1X NOTIFY changed)
- Q_PROPERTY(qreal control1Y READ control1Y WRITE setControl1Y NOTIFY changed)
- Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY changed)
- Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY changed)
+ Q_PROPERTY(qreal control1X READ control1X WRITE setControl1X NOTIFY control1XChanged)
+ Q_PROPERTY(qreal control1Y READ control1Y WRITE setControl1Y NOTIFY control1YChanged)
+ Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY control2XChanged)
+ Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY control2YChanged)
public:
QDeclarativePathCubic(QObject *parent=0) : QDeclarativeCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {}
@@ -165,11 +174,17 @@ public:
void addToPath(QPainterPath &path);
+Q_SIGNALS:
+ void control1XChanged();
+ void control1YChanged();
+ void control2XChanged();
+ void control2YChanged();
+
private:
- int _control1X;
- int _control1Y;
- int _control2X;
- int _control2Y;
+ qreal _control1X;
+ qreal _control1Y;
+ qreal _control2X;
+ qreal _control2Y;
};
class Q_AUTOTEST_EXPORT QDeclarativePathPercent : public QDeclarativePathElement
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index acf9827..06ac275 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -90,6 +90,26 @@ void QDeclarativePathViewAttached::setValue(const QByteArray &name, const QVaria
m_metaobject->setValue(name, val);
}
+
+void QDeclarativePathViewPrivate::init()
+{
+ Q_Q(QDeclarativePathView);
+ offset = 0;
+ q->setAcceptedMouseButtons(Qt::LeftButton);
+ q->setFlag(QGraphicsItem::ItemIsFocusScope);
+ q->setFiltersChildEvents(true);
+ q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked()));
+ lastPosTime.invalidate();
+ static int timelineCompletedIdx = -1;
+ static int movementEndingIdx = -1;
+ if (timelineCompletedIdx == -1) {
+ timelineCompletedIdx = QDeclarativeTimeLine::staticMetaObject.indexOfSignal("completed()");
+ movementEndingIdx = QDeclarativePathView::staticMetaObject.indexOfSlot("movementEnding()");
+ }
+ QMetaObject::connect(&tl, timelineCompletedIdx,
+ q, movementEndingIdx, Qt::DirectConnection);
+}
+
QDeclarativeItem *QDeclarativePathViewPrivate::getItem(int modelIndex)
{
Q_Q(QDeclarativePathView);
@@ -314,7 +334,7 @@ void QDeclarativePathViewPrivate::regenerate()
and XmlListModel, or custom model classes defined in C++ that inherit from
QAbstractListModel.
- A ListView has a \l model, which defines the data to be displayed, and
+ The view has a \l model, which defines the data to be displayed, and
a \l delegate, which defines how the data should be displayed.
The \l delegate is instantiated for each item on the \l path.
The items may be flicked to move them along the path.
@@ -333,6 +353,9 @@ void QDeclarativePathViewPrivate::regenerate()
opacity of the items as they rotate. This additional code can be seen in the
PathAttribute documentation.)
+ The \c focus can be set to \c true to enable keyboard navigation.
+ The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
@@ -341,7 +364,7 @@ void QDeclarativePathViewPrivate::regenerate()
to set \e {clip: true} in order to have the out of view items clipped
nicely.
- \sa Path
+ \sa Path, {declarative/modelviews/pathview}{PathView example}
*/
QDeclarativePathView::QDeclarativePathView(QDeclarativeItem *parent)
@@ -848,6 +871,61 @@ void QDeclarativePathView::setInteractive(bool interactive)
}
/*!
+ \qmlproperty bool PathView::moving
+
+ This property holds whether the view is currently moving
+ due to the user either dragging or flicking the view.
+*/
+bool QDeclarativePathView::isMoving() const
+{
+ Q_D(const QDeclarativePathView);
+ return d->moving;
+}
+
+/*!
+ \qmlproperty bool PathView::flicking
+
+ This property holds whether the view is currently moving
+ due to the user flicking the view.
+*/
+bool QDeclarativePathView::isFlicking() const
+{
+ Q_D(const QDeclarativePathView);
+ return d->flicking;
+}
+
+/*!
+ \qmlsignal PathView::onMovementStarted()
+
+ This handler is called when the view begins moving due to user
+ interaction.
+*/
+
+/*!
+ \qmlsignal PathView::onMovementEnded()
+
+ This handler is called when the view stops moving due to user
+ interaction. If a flick was generated, this handler will
+ be triggered once the flick stops. If a flick was not
+ generated, the handler will be triggered when the
+ user stops dragging - i.e. a mouse or touch release.
+*/
+
+/*!
+ \qmlsignal PathView::onFlickStarted()
+
+ This handler is called when the view is flicked. A flick
+ starts from the point that the mouse or touch is released,
+ while still in motion.
+*/
+
+/*!
+ \qmlsignal PathView::onFlickEnded()
+
+ This handler is called when the view stops moving due to a flick.
+*/
+
+/*!
\qmlproperty Component PathView::delegate
The delegate provides a template defining each item instantiated by the view.
@@ -964,7 +1042,11 @@ void QDeclarativePathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
return;
}
- d->stealMouse = false;
+ if (d->tl.isActive() && d->flicking)
+ d->stealMouse = true; // If we've been flicked then steal the click.
+ else
+ d->stealMouse = false;
+
d->lastElapsed = 0;
d->lastDist = 0;
QDeclarativeItemPrivate::start(d->lastPosTime);
@@ -1000,6 +1082,11 @@ void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
d->lastDist = diff;
d->startPc = newPc;
}
+ if (!d->moving) {
+ d->moving = true;
+ emit movingChanged();
+ emit movementStarted();
+ }
}
}
@@ -1039,12 +1126,19 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
d->moveOffset.setValue(d->offset);
d->tl.accel(d->moveOffset, velocity, accel, dist);
d->tl.callback(QDeclarativeTimeLineCallback(&d->moveOffset, d->fixOffsetCallback, d));
+ if (!d->flicking) {
+ d->flicking = true;
+ emit flickingChanged();
+ emit flickStarted();
+ }
} else {
d->fixOffset();
}
d->lastPosTime.invalidate();
ungrabMouse();
+ if (!d->tl.isActive())
+ movementEnding();
}
bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
@@ -1372,6 +1466,21 @@ void QDeclarativePathView::ticked()
d->updateCurrent();
}
+void QDeclarativePathView::movementEnding()
+{
+ Q_D(QDeclarativePathView);
+ if (d->flicking) {
+ d->flicking = false;
+ emit flickingChanged();
+ emit flickEnded();
+ }
+ if (d->moving && !d->stealMouse) {
+ d->moving = false;
+ emit movingChanged();
+ emit movementEnded();
+ }
+}
+
// find the item closest to the snap position
int QDeclarativePathViewPrivate::calcCurrentIndex()
{
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h
index d2980c6..035a64b 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h
@@ -74,6 +74,9 @@ class Q_AUTOTEST_EXPORT QDeclarativePathView : public QDeclarativeItem
Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged)
+ Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged)
+ Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged)
+
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount NOTIFY pathItemCountChanged)
@@ -122,6 +125,9 @@ public:
bool isInteractive() const;
void setInteractive(bool);
+ bool isMoving() const;
+ bool isFlicking() const;
+
int count() const;
QDeclarativeComponent *delegate() const;
@@ -151,9 +157,15 @@ Q_SIGNALS:
void pathItemCountChanged();
void flickDecelerationChanged();
void interactiveChanged();
+ void movingChanged();
+ void flickingChanged();
void highlightChanged();
void highlightItemChanged();
void highlightMoveDurationChanged();
+ void movementStarted();
+ void movementEnded();
+ void flickStarted();
+ void flickEnded();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
@@ -167,6 +179,7 @@ protected:
private Q_SLOTS:
void refill();
void ticked();
+ void movementEnding();
void itemsInserted(int index, int count);
void itemsRemoved(int index, int count);
void itemsMoved(int,int,int);
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index a0d2610..9abec2e 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -78,6 +78,7 @@ public:
, lastElapsed(0), mappedRange(1.0)
, stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)
, autoHighlight(true), highlightUp(false), layoutScheduled(false)
+ , moving(false), flicking(false)
, dragMargin(0), deceleration(100)
, moveOffset(this, &QDeclarativePathViewPrivate::setOffset)
, firstIndex(-1), pathItems(-1), requestedIndex(-1)
@@ -90,15 +91,7 @@ public:
{
}
- void init() {
- Q_Q(QDeclarativePathView);
- offset = 0;
- q->setAcceptedMouseButtons(Qt::LeftButton);
- q->setFlag(QGraphicsItem::ItemIsFocusScope);
- q->setFiltersChildEvents(true);
- q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked()));
- lastPosTime.invalidate();
- }
+ void init();
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) {
if ((newGeometry.size() != oldGeometry.size())
@@ -155,6 +148,8 @@ public:
bool autoHighlight : 1;
bool highlightUp : 1;
bool layoutScheduled : 1;
+ bool moving : 1;
+ bool flicking : 1;
QElapsedTimer lastPosTime;
QPointF lastPos;
qreal dragMargin;
diff --git a/src/declarative/graphicsitems/qdeclarativetranslate.cpp b/src/declarative/graphicsitems/qdeclarativetranslate.cpp
index 16a1127..be9b3f3 100644
--- a/src/declarative/graphicsitems/qdeclarativetranslate.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetranslate.cpp
@@ -90,7 +90,7 @@ void QDeclarativeTranslate::setX(qreal x)
return;
d->x = x;
update();
- emit positionChanged();
+ emit xChanged();
}
/*!
@@ -113,7 +113,7 @@ void QDeclarativeTranslate::setY(qreal y)
return;
d->y = y;
update();
- emit positionChanged();
+ emit yChanged();
}
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativetranslate_p.h b/src/declarative/graphicsitems/qdeclarativetranslate_p.h
index 0207dce..b871518 100644
--- a/src/declarative/graphicsitems/qdeclarativetranslate_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetranslate_p.h
@@ -56,8 +56,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeTranslate : public QGraphicsTransform
{
Q_OBJECT
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY positionChanged)
- Q_PROPERTY(qreal y READ y WRITE setY NOTIFY positionChanged)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
public:
QDeclarativeTranslate(QObject *parent = 0);
@@ -72,7 +72,8 @@ public:
void applyTo(QMatrix4x4 *matrix) const;
Q_SIGNALS:
- void positionChanged();
+ void xChanged();
+ void yChanged();
private:
Q_DECLARE_PRIVATE(QDeclarativeTranslate)
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 8c1c95a..6a9cf95 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -939,7 +939,7 @@ void QDeclarativePropertyAction::setTarget(QObject *o)
if (d->target == o)
return;
d->target = o;
- emit targetChanged(d->target, d->propertyName);
+ emit targetChanged();
}
QString QDeclarativePropertyAction::property() const
@@ -954,7 +954,7 @@ void QDeclarativePropertyAction::setProperty(const QString &n)
if (d->propertyName == n)
return;
d->propertyName = n;
- emit targetChanged(d->target, d->propertyName);
+ emit propertyChanged();
}
/*!
@@ -2104,7 +2104,7 @@ void QDeclarativePropertyAnimation::setTarget(QObject *o)
if (d->target == o)
return;
d->target = o;
- emit targetChanged(d->target, d->propertyName);
+ emit targetChanged();
}
QString QDeclarativePropertyAnimation::property() const
@@ -2119,7 +2119,7 @@ void QDeclarativePropertyAnimation::setProperty(const QString &n)
if (d->propertyName == n)
return;
d->propertyName = n;
- emit targetChanged(d->target, d->propertyName);
+ emit propertyChanged();
}
QString QDeclarativePropertyAnimation::properties() const
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 59bd465..481c36c 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -197,7 +197,7 @@ class QDeclarativePropertyAction : public QDeclarativeAbstractAnimation
Q_DECLARE_PRIVATE(QDeclarativePropertyAction)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
- Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
Q_PROPERTY(QDeclarativeListProperty<QObject> targets READ targets)
Q_PROPERTY(QDeclarativeListProperty<QObject> exclude READ exclude)
@@ -225,7 +225,8 @@ public:
Q_SIGNALS:
void valueChanged(const QVariant &);
void propertiesChanged(const QString &);
- void targetChanged(QObject *, const QString &);
+ void targetChanged();
+ void propertyChanged();
protected:
virtual void transition(QDeclarativeStateActions &actions,
@@ -246,7 +247,7 @@ class Q_AUTOTEST_EXPORT QDeclarativePropertyAnimation : public QDeclarativeAbstr
Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
- Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
Q_PROPERTY(QDeclarativeListProperty<QObject> targets READ targets)
Q_PROPERTY(QDeclarativeListProperty<QObject> exclude READ exclude)
@@ -292,7 +293,8 @@ Q_SIGNALS:
void toChanged(QVariant);
void easingChanged(const QEasingCurve &);
void propertiesChanged(const QString &);
- void targetChanged(QObject *, const QString &);
+ void targetChanged();
+ void propertyChanged();
};
class Q_AUTOTEST_EXPORT QDeclarativeColorAnimation : public QDeclarativePropertyAnimation
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
index 4ab6975..986bee6 100644
--- a/src/gui/graphicsview/qgraphicstransform.cpp
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -267,6 +267,7 @@ void QGraphicsScale::setXScale(qreal scale)
return;
d->xScale = scale;
update();
+ emit xScaleChanged();
emit scaleChanged();
}
@@ -293,6 +294,7 @@ void QGraphicsScale::setYScale(qreal scale)
return;
d->yScale = scale;
update();
+ emit yScaleChanged();
emit scaleChanged();
}
@@ -319,6 +321,7 @@ void QGraphicsScale::setZScale(qreal scale)
return;
d->zScale = scale;
update();
+ emit zScaleChanged();
emit scaleChanged();
}
diff --git a/src/gui/graphicsview/qgraphicstransform.h b/src/gui/graphicsview/qgraphicstransform.h
index 58b201a..d8c9654 100644
--- a/src/gui/graphicsview/qgraphicstransform.h
+++ b/src/gui/graphicsview/qgraphicstransform.h
@@ -85,9 +85,9 @@ class Q_GUI_EXPORT QGraphicsScale : public QGraphicsTransform
Q_OBJECT
Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
- Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY scaleChanged)
- Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY scaleChanged)
- Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY scaleChanged)
+ Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY xScaleChanged)
+ Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged)
+ Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged)
public:
QGraphicsScale(QObject *parent = 0);
~QGraphicsScale();
@@ -108,6 +108,9 @@ public:
Q_SIGNALS:
void originChanged();
+ void xScaleChanged();
+ void yScaleChanged();
+ void zScaleChanged();
void scaleChanged();
private: