diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-11-09 03:32:23 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-11-09 03:32:23 (GMT) |
commit | e0cb271b01d18fb178b2c17969c0bf0bff880aed (patch) | |
tree | d26a718741ec1bfc0d7768067c5a8e827e7dcd0a /src/declarative/graphicsitems | |
parent | 1424d6be3691bafc980693c01532938dc4a640a6 (diff) | |
parent | 82e142d6b52153024bd05fa3a7853be7c64bb3bb (diff) | |
download | Qt-e0cb271b01d18fb178b2c17969c0bf0bff880aed.zip Qt-e0cb271b01d18fb178b2c17969c0bf0bff880aed.tar.gz Qt-e0cb271b01d18fb178b2c17969c0bf0bff880aed.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/graphicsitems')
5 files changed, 32 insertions, 40 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp index b030495..ea9c173 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp @@ -1177,7 +1177,7 @@ void QmlGraphicsFlickable::setMaximumFlickVelocity(qreal v) } /*! - \qmlproperty real Flickable::maximumFlickVelocity + \qmlproperty real Flickable::flickDeceleration This property holds the rate at which a flick will decelerate. The default is 500. diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index a9bc721..53287a6 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -434,7 +434,6 @@ void QmlGraphicsListViewPrivate::clear() visibleIndex = 0; releaseItem(currentItem); currentItem = 0; - currentIndex = -1; createHighlight(); trackedItem = 0; } @@ -746,7 +745,7 @@ void QmlGraphicsListViewPrivate::updateCurrentSection() void QmlGraphicsListViewPrivate::updateCurrent(int modelIndex) { Q_Q(QmlGraphicsListView); - if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { + if (!q->isComponentComplete() || !isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { currentItem->attached->setIsCurrentItem(false); releaseItem(currentItem); @@ -1114,16 +1113,20 @@ void QmlGraphicsListView::setModel(const QVariant &model) dataModel->setModel(model); } if (d->model) { - if (d->currentIndex >= d->model->count() || d->currentIndex < 0) - setCurrentIndex(0); - else - d->updateCurrent(d->currentIndex); + if (isComponentComplete()) { + refill(); + if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { + setCurrentIndex(0); + } else { + d->moveReason = QmlGraphicsListViewPrivate::SetIndex; + d->updateCurrent(d->currentIndex); + } + } connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); - refill(); emit countChanged(); } } @@ -1156,8 +1159,11 @@ void QmlGraphicsListView::setDelegate(QmlComponent *delegate) } if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) { dataModel->setDelegate(delegate); - d->updateCurrent(d->currentIndex); - refill(); + if (isComponentComplete()) { + refill(); + d->moveReason = QmlGraphicsListViewPrivate::SetIndex; + d->updateCurrent(d->currentIndex); + } } } @@ -1178,7 +1184,7 @@ int QmlGraphicsListView::currentIndex() const void QmlGraphicsListView::setCurrentIndex(int index) { Q_D(QmlGraphicsListView); - if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { + if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { d->moveReason = QmlGraphicsListViewPrivate::SetIndex; cancelFlick(); d->updateCurrent(index); @@ -1254,7 +1260,7 @@ void QmlGraphicsListView::setHighlight(QmlComponent *highlight) is scrolled. This is because the view moves to maintain the highlight within the preferred highlight range (or visible viewport). - \sa highlight + \sa highlight, highlightMoveSpeed */ bool QmlGraphicsListView::highlightFollowsCurrentItem() const { @@ -1473,8 +1479,13 @@ QString QmlGraphicsListView::currentSection() const /*! \qmlproperty real ListView::highlightMoveSpeed + \qmlproperty real ListView::highlightResizeSpeed + These properties hold the move and resize animation speed of the highlight delegate. + + highlightFollowsCurrentItem must be true for these properties + to have effect. - This property holds the moving animation speed of the highlight delegate. + \sa highlightFollowsCurrentItem */ qreal QmlGraphicsListView::highlightMoveSpeed() const { @@ -1494,11 +1505,6 @@ void QmlGraphicsListView::setHighlightMoveSpeed(qreal speed) } } -/*! - \qmlproperty real ListView::highlightResizeSpeed - - This property holds the resizing animation speed of the highlight delegate. -*/ qreal QmlGraphicsListView::highlightResizeSpeed() const { Q_D(const QmlGraphicsListView);\ @@ -1670,9 +1676,11 @@ void QmlGraphicsListView::componentComplete() { Q_D(QmlGraphicsListView); QmlGraphicsFlickable::componentComplete(); + refill(); if (d->currentIndex < 0) d->updateCurrent(0); - refill(); + else + d->updateCurrent(d->currentIndex); d->fixupPosition(); } diff --git a/src/declarative/graphicsitems/qmlgraphicslistview_p.h b/src/declarative/graphicsitems/qmlgraphicslistview_p.h index 446d71a..3f46434 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicslistview_p.h @@ -64,8 +64,11 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(QmlGraphicsItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QmlComponent *highlight READ highlight WRITE setHighlight) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) + 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) @@ -78,8 +81,6 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged) Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged) - Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged) - Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) Q_ENUMS(HighlightRangeMode) Q_ENUMS(Orientation) Q_CLASSINFO("DefaultProperty", "data") diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index 5ce0ee8..214117f 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -464,7 +464,8 @@ void QmlGraphicsWebView::setPreferredWidth(int iw) /*! \qmlproperty int WebView::webPageWidth - This property holds the page width suggested to the web engine. + This property holds the page width suggested to the web engine. The zoomFactor + will be changed to fit this with in preferredWidth. */ int QmlGraphicsWebView::webPageWidth() const { @@ -906,20 +907,6 @@ QPixmap QmlGraphicsWebView::icon() const /*! - \qmlproperty real WebView::textSizeMultiplier - This property holds the multiplier used to scale the text in a Web page -*/ -void QmlGraphicsWebView::setTextSizeMultiplier(qreal factor) -{ - page()->mainFrame()->setTextSizeMultiplier(factor); -} - -qreal QmlGraphicsWebView::textSizeMultiplier() const -{ - return page()->mainFrame()->textSizeMultiplier(); -} - -/*! \qmlproperty real WebView::zoomFactor This property holds the multiplier used to scale the contents of a Web page. */ diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index 6852bb0..d574c59 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -88,7 +88,6 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem Q_PROPERTY(QString title READ title NOTIFY titleChanged) Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) - Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false) Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) @@ -126,9 +125,6 @@ public: QPixmap icon() const; - qreal textSizeMultiplier() const; - void setTextSizeMultiplier(qreal); - qreal zoomFactor() const; void setZoomFactor(qreal); |