summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-02-26 06:34:28 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-03-02 03:15:24 (GMT)
commit05f9a6aa5d6e4f20eb4dacff3acea9d186867ab1 (patch)
tree4e67aee95c06cec5da195657132ba90f60f1c64a /src/declarative
parente71f8823d22c99a4da7de4f49463a05427186c0f (diff)
downloadQt-05f9a6aa5d6e4f20eb4dacff3acea9d186867ab1.zip
Qt-05f9a6aa5d6e4f20eb4dacff3acea9d186867ab1.tar.gz
Qt-05f9a6aa5d6e4f20eb4dacff3acea9d186867ab1.tar.bz2
Add NOTIFY signals to list, grid and path views
Reviewed-by: akennedy
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp12
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h20
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp24
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h38
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p.h11
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp26
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p.h18
8 files changed, 124 insertions, 36 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 8d778f8..090c46d 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -619,7 +619,7 @@ void QDeclarativeGridViewPrivate::createHighlight()
}
}
if (changed)
- emit q->highlightChanged();
+ emit q->highlightItemChanged();
}
void QDeclarativeGridViewPrivate::updateHighlight()
@@ -785,6 +785,8 @@ QVariant QDeclarativeGridView::model() const
void QDeclarativeGridView::setModel(const QVariant &model)
{
Q_D(QDeclarativeGridView);
+ if (d->modelVariant == model)
+ return;
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
@@ -829,6 +831,7 @@ void QDeclarativeGridView::setModel(const QVariant &model)
connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
emit countChanged();
}
+ emit modelChanged();
}
/*!
@@ -872,6 +875,7 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate)
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
}
+ emit delegateChanged();
}
}
@@ -967,6 +971,7 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight)
if (highlight != d->highlightComponent) {
d->highlightComponent = highlight;
d->updateCurrent(d->currentIndex);
+ emit highlightChanged();
}
}
@@ -1040,6 +1045,7 @@ void QDeclarativeGridView::setFlow(Flow flow)
d->updateGrid();
refill();
d->updateCurrent(d->currentIndex);
+ emit flowChanged();
}
}
@@ -1059,7 +1065,10 @@ bool QDeclarativeGridView::isWrapEnabled() const
void QDeclarativeGridView::setWrapEnabled(bool wrap)
{
Q_D(QDeclarativeGridView);
+ if (d->wrap == wrap)
+ return;
d->wrap = wrap;
+ emit keyNavigationWrapsChanged();
}
/*!
@@ -1083,6 +1092,7 @@ void QDeclarativeGridView::setCacheBuffer(int buffer)
d->buffer = buffer;
if (isComponentComplete())
refill();
+ emit cacheBufferChanged();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index b488475..d463a46 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -57,19 +57,19 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable
Q_OBJECT
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGridView)
- Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight)
- Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged)
+ Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged)
+ Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged)
Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem)
- Q_PROPERTY(Flow flow READ flow WRITE setFlow)
- Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled)
- Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer)
+ Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
+ Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged)
+ Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged)
Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight NOTIFY cellHeightChanged)
Q_CLASSINFO("DefaultProperty", "data")
@@ -129,6 +129,12 @@ Q_SIGNALS:
void cellWidthChanged();
void cellHeightChanged();
void highlightChanged();
+ void highlightItemChanged();
+ void modelChanged();
+ void delegateChanged();
+ void flowChanged();
+ void keyNavigationWrapsChanged();
+ void cacheBufferChanged();
protected:
virtual void viewportMoved();
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 02a8493..a05e638 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -817,7 +817,7 @@ void QDeclarativeListViewPrivate::createHighlight()
}
}
if (changed)
- emit q->highlightChanged();
+ emit q->highlightItemChanged();
}
void QDeclarativeListViewPrivate::updateHighlight()
@@ -1474,6 +1474,8 @@ QVariant QDeclarativeListView::model() const
void QDeclarativeListView::setModel(const QVariant &model)
{
Q_D(QDeclarativeListView);
+ if (d->modelVariant == model)
+ return;
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
@@ -1518,6 +1520,7 @@ void QDeclarativeListView::setModel(const QVariant &model)
connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
emit countChanged();
}
+ emit modelChanged();
}
/*!
@@ -1564,6 +1567,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
d->updateCurrent(d->currentIndex);
}
}
+ emit delegateChanged();
}
/*!
@@ -1664,6 +1668,7 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight)
d->createHighlight();
if (d->currentItem)
d->updateHighlight();
+ emit highlightChanged();
}
}
@@ -1701,6 +1706,7 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight)
d->highlightSizeAnimator->setEnabled(d->autoHighlight);
}
d->updateHighlight();
+ emit highlightFollowsCurrentItemChanged();
}
}
@@ -1746,8 +1752,11 @@ qreal QDeclarativeListView::preferredHighlightBegin() const
void QDeclarativeListView::setPreferredHighlightBegin(qreal start)
{
Q_D(QDeclarativeListView);
+ if (d->highlightRangeStart == start)
+ return;
d->highlightRangeStart = start;
d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd;
+ emit preferredHighlightBeginChanged();
}
qreal QDeclarativeListView::preferredHighlightEnd() const
@@ -1759,8 +1768,11 @@ qreal QDeclarativeListView::preferredHighlightEnd() const
void QDeclarativeListView::setPreferredHighlightEnd(qreal end)
{
Q_D(QDeclarativeListView);
+ if (d->highlightRangeEnd == end)
+ return;
d->highlightRangeEnd = end;
d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd;
+ emit preferredHighlightEndChanged();
}
QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMode() const
@@ -1772,8 +1784,11 @@ QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMod
void QDeclarativeListView::setHighlightRangeMode(HighlightRangeMode mode)
{
Q_D(QDeclarativeListView);
+ if (d->highlightRange == mode)
+ return;
d->highlightRange = mode;
d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd;
+ emit highlightRangeModeChanged();
}
/*!
@@ -1849,7 +1864,10 @@ bool QDeclarativeListView::isWrapEnabled() const
void QDeclarativeListView::setWrapEnabled(bool wrap)
{
Q_D(QDeclarativeListView);
+ if (d->wrap == wrap)
+ return;
d->wrap = wrap;
+ emit keyNavigationWrapsChanged();
}
/*!
@@ -1875,6 +1893,7 @@ void QDeclarativeListView::setCacheBuffer(int b)
d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter;
refill();
}
+ emit cacheBufferChanged();
}
}
@@ -1999,6 +2018,7 @@ void QDeclarativeListView::setSnapMode(SnapMode mode)
Q_D(QDeclarativeListView);
if (d->snapMode != mode) {
d->snapMode = mode;
+ emit snapModeChanged();
}
}
@@ -2021,6 +2041,7 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer)
d->maxExtentDirty = true;
d->updateFooter();
d->updateViewport();
+ emit footerChanged();
}
}
@@ -2044,6 +2065,7 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header)
d->updateHeader();
d->updateFooter();
d->updateViewport();
+ emit headerChanged();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index 5e3edb0..f9b7b50 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -91,33 +91,33 @@ class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable
Q_OBJECT
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView)
- Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight)
- Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged)
- Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem)
+ Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged)
+ Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged)
+ Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged)
Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
- Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin)
- Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd)
- Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode)
+ Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged)
+ Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged)
+ Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged)
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
- Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled)
- Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer)
+ Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged)
+ Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT)
Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged)
- Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode)
+ Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged)
- Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader)
- Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter)
+ Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader NOTIFY headerChanged)
+ Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter NOTIFY footerChanged)
Q_ENUMS(HighlightRangeMode)
Q_ENUMS(Orientation)
@@ -205,6 +205,18 @@ Q_SIGNALS:
void highlightMoveSpeedChanged();
void highlightResizeSpeedChanged();
void highlightChanged();
+ void highlightItemChanged();
+ void modelChanged();
+ void delegateChanged();
+ void highlightFollowsCurrentItemChanged();
+ void preferredHighlightBeginChanged();
+ void preferredHighlightEndChanged();
+ void highlightRangeModeChanged();
+ void keyNavigationWrapsChanged();
+ void cacheBufferChanged();
+ void snapModeChanged();
+ void headerChanged();
+ void footerChanged();
protected:
virtual void viewportMoved();
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index 48f112a..80586b8 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -114,7 +114,10 @@ qreal QDeclarativePath::startX() const
void QDeclarativePath::setStartX(qreal x)
{
Q_D(QDeclarativePath);
+ if (qFuzzyCompare(x, d->startX))
+ return;
d->startX = x;
+ emit startXChanged();
}
qreal QDeclarativePath::startY() const
@@ -126,7 +129,10 @@ qreal QDeclarativePath::startY() const
void QDeclarativePath::setStartY(qreal y)
{
Q_D(QDeclarativePath);
+ if (qFuzzyCompare(y, d->startY))
+ return;
d->startY = y;
+ emit startYChanged();
}
/*!
@@ -522,7 +528,10 @@ QString QDeclarativePathAttribute::name() const
void QDeclarativePathAttribute::setName(const QString &name)
{
- _name = name;
+ if (_name == name)
+ return;
+ _name = name;
+ emit nameChanged();
}
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h
index b3139f8..d7cfca1 100644
--- a/src/declarative/graphicsitems/qdeclarativepath_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p.h
@@ -67,7 +67,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathAttribute : public QDeclarativePathEl
{
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed)
public:
QDeclarativePathAttribute(QObject *parent=0) : QDeclarativePathElement(parent), _value(0) {}
@@ -79,6 +79,9 @@ public:
qreal value() const;
void setValue(qreal value);
+Q_SIGNALS:
+ void nameChanged();
+
private:
QString _name;
qreal _value;
@@ -190,8 +193,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativePath : public QObject, public QDeclarativ
Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativePathElement> pathElements READ pathElements)
- Q_PROPERTY(qreal startX READ startX WRITE setStartX)
- Q_PROPERTY(qreal startY READ startY WRITE setStartY)
+ Q_PROPERTY(qreal startX READ startX WRITE setStartX NOTIFY startXChanged)
+ Q_PROPERTY(qreal startY READ startY WRITE setStartY NOTIFY startYChanged)
Q_PROPERTY(bool closed READ isClosed NOTIFY changed)
Q_CLASSINFO("DefaultProperty", "pathElements")
Q_INTERFACES(QDeclarativeParserStatus)
@@ -216,6 +219,8 @@ public:
Q_SIGNALS:
void changed();
+ void startXChanged();
+ void startYChanged();
protected:
virtual void componentComplete();
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index f1b0213..50aa9ef 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -203,6 +203,9 @@ QVariant QDeclarativePathView::model() const
void QDeclarativePathView::setModel(const QVariant &model)
{
Q_D(QDeclarativePathView);
+ if (d->modelVariant == model)
+ return;
+
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
@@ -242,6 +245,7 @@ void QDeclarativePathView::setModel(const QVariant &model)
d->pathOffset = 0;
d->regenerate();
d->fixOffset();
+ emit modelChanged();
}
/*!
@@ -269,9 +273,12 @@ QDeclarativePath *QDeclarativePathView::path() const
void QDeclarativePathView::setPath(QDeclarativePath *path)
{
Q_D(QDeclarativePathView);
+ if (d->path == path)
+ return;
d->path = path;
connect(d->path, SIGNAL(changed()), this, SLOT(refill()));
d->regenerate();
+ emit pathChanged();
}
/*!
@@ -333,7 +340,7 @@ void QDeclarativePathViewPrivate::setOffset(qreal o)
/*!
\qmlproperty real PathView::snapPosition
- This property determines the position (0-100) the nearest item will snap to.
+ This property determines the position (0.0-1.0) the nearest item will snap to.
*/
qreal QDeclarativePathView::snapPosition() const
{
@@ -344,8 +351,12 @@ qreal QDeclarativePathView::snapPosition() const
void QDeclarativePathView::setSnapPosition(qreal pos)
{
Q_D(QDeclarativePathView);
- d->snapPos = pos/100;
+ qreal normalizedPos = pos - int(pos);
+ if (qFuzzyCompare(normalizedPos, d->snapPos))
+ return;
+ d->snapPos = normalizedPos;
d->fixOffset();
+ emit snapPositionChanged();
}
/*!
@@ -365,7 +376,10 @@ qreal QDeclarativePathView::dragMargin() const
void QDeclarativePathView::setDragMargin(qreal dragMargin)
{
Q_D(QDeclarativePathView);
+ if (d->dragMargin == dragMargin)
+ return;
d->dragMargin = dragMargin;
+ emit dragMarginChanged();
}
/*!
@@ -392,16 +406,19 @@ QDeclarativeComponent *QDeclarativePathView::delegate() const
return 0;
}
-void QDeclarativePathView::setDelegate(QDeclarativeComponent *c)
+void QDeclarativePathView::setDelegate(QDeclarativeComponent *delegate)
{
Q_D(QDeclarativePathView);
+ if (delegate == this->delegate())
+ return;
if (!d->ownModel) {
d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
- dataModel->setDelegate(c);
+ dataModel->setDelegate(delegate);
d->regenerate();
+ emit delegateChanged();
}
}
@@ -422,6 +439,7 @@ void QDeclarativePathView::setPathItemCount(int i)
return;
d->pathItems = i;
d->regenerate();
+ pathItemCountChanged();
}
QPointF QDeclarativePathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h
index 709a4fc..df9c6ae 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h
@@ -56,15 +56,15 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem
{
Q_OBJECT
- Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath)
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged)
- Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition)
- Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin)
+ Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition NOTIFY snapPositionChanged)
+ Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged)
Q_PROPERTY(int count READ count)
- Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
- Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
+ Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount NOTIFY pathItemCountChanged)
public:
QDeclarativePathView(QDeclarativeItem *parent=0);
@@ -101,6 +101,12 @@ public:
Q_SIGNALS:
void currentIndexChanged();
void offsetChanged();
+ void modelChanged();
+ void pathChanged();
+ void dragMarginChanged();
+ void snapPositionChanged();
+ void delegateChanged();
+ void pathItemCountChanged();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);