diff options
25 files changed, 147 insertions, 166 deletions
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index ab94d7a0a6..f91b365b4c 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -50,7 +50,7 @@ Flipable { LikeOMeter { x: 40; y: 250; rating: container.rating } Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true - viewportWidth: 480; viewportHeight: descriptionText.height + contentWidth: 480; contentHeight: descriptionText.height WebView { id: descriptionText; width: parent.width html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + container.photoDescription } @@ -84,7 +84,7 @@ Flipable { Flickable { id: flick; width: container.width - 10; height: container.height - 10 x: 5; y: 5; clip: true; - viewportWidth: imageContainer.width; viewportHeight: imageContainer.height + contentWidth: imageContainer.width; contentHeight: imageContainer.height Item { id: imageContainer @@ -122,12 +122,12 @@ Flipable { id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum } onValueChanged: { if (bigImage.width * value > flick.width) { - var xoff = (flick.width/2 + flick.viewportX) * value / prevScale; - flick.viewportX = xoff - flick.width/2; + var xoff = (flick.width/2 + flick.contentX) * value / prevScale; + flick.contentX = xoff - flick.width/2; } if (bigImage.height * value > flick.height) { - var yoff = (flick.height/2 + flick.viewportY) * value / prevScale; - flick.viewportY = yoff - flick.height/2; + var yoff = (flick.height/2 + flick.contentY) * value / prevScale; + flick.contentY = yoff - flick.height/2; } prevScale = value; } diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 415764e1ee..8749b4c614 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -57,7 +57,7 @@ Flipable { Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 } Flickable { id: flickable; anchors.fill: parent; clip: true - viewportWidth: imageContainer.width; viewportHeight: imageContainer.height + contentWidth: imageContainer.width; contentHeight: imageContainer.height Item { id: imageContainer @@ -97,12 +97,12 @@ Flipable { } onValueChanged: { if (bigImage.width * value > flickable.width) { - var xoff = (flickable.width/2 + flickable.viewportX) * value / prevScale; - flickable.viewportX = xoff - flickable.width/2; + var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale; + flickable.contentX = xoff - flickable.width/2; } if (bigImage.height * value > flickable.height) { - var yoff = (flickable.height/2 + flickable.viewportY) * value / prevScale; - flickable.viewportY = yoff - flickable.height/2; + var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale; + flickable.contentY = yoff - flickable.height/2; } prevScale = value; } diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index b60a95f2a5..e686d0268e 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -10,8 +10,8 @@ Flickable { id: flickable width: parent.width - viewportWidth: Math.max(parent.width,webView.width*webView.scale) - viewportHeight: Math.max(parent.height,webView.height*webView.scale) + contentWidth: Math.max(parent.width,webView.width*webView.scale) + contentHeight: Math.max(parent.height,webView.height*webView.scale) anchors.top: headerSpace.bottom anchors.bottom: footer.top anchors.left: parent.left @@ -53,10 +53,10 @@ Flickable { if (centerX) { var sc = zoom/contentsScale; scaleAnim.to = sc; - flickVX.from = flickable.viewportX + flickVX.from = flickable.contentX flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) finalX.value = flickVX.to - flickVY.from = flickable.viewportY + flickVY.from = flickable.contentY flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) finalY.value = flickVY.to finalZoom.value = zoom @@ -76,8 +76,8 @@ Flickable { } onUrlChanged: { // got to topleft - flickable.viewportX = 0 - flickable.viewportY = 0 + flickable.contentX = 0 + flickable.contentY = 0 if (url != null) { header.editUrl = url.toString(); } } onDoubleClick: { @@ -110,7 +110,7 @@ Flickable { NumberAnimation { id: flickVX target: flickable - property: "viewportX" + property: "contentX" easing.type: "Linear" duration: 200 from: 0 // set before calling @@ -119,7 +119,7 @@ Flickable { NumberAnimation { id: flickVY target: flickable - property: "viewportY" + property: "contentY" easing.type: "Linear" duration: 200 from: 0 // set before calling @@ -136,19 +136,19 @@ Flickable { property: "scale" value: 1.0 } - // Have to set the viewportXY, since the above 2 + // Have to set the contentXY, since the above 2 // size changes may have started a correction if // contentsScale < 1.0. PropertyAction { id: finalX target: flickable - property: "viewportX" + property: "contentX" value: 0 // set before calling } PropertyAction { id: finalY target: flickable - property: "viewportY" + property: "contentY" value: 0 // set before calling } PropertyAction { diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml index f9051500ed..e8c9208b79 100644 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml @@ -9,10 +9,10 @@ Image { source: "pics/header.png" width: parent.width height: 60 - x: webView.viewportX < 0 ? -webView.viewportX : webView.viewportX > webView.viewportWidth-webView.width - ? -webView.viewportX+webView.viewportWidth-webView.width : 0 - y: webView.viewportY < 0 ? -webView.viewportY : progressOff* - (webView.viewportY>height?-height:-webView.viewportY) + x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width + ? -webView.contentX+webView.contentWidth-webView.width : 0 + y: webView.contentY < 0 ? -webView.contentY : progressOff* + (webView.contentY>height?-height:-webView.contentY) Text { id: headerText diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index faafd5d497..6a427f42d1 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -30,10 +30,10 @@ Item { anchors.bottom: footer.top } RectSoftShadow { - x: -webView.viewportX - y: -webView.viewportY - width: webView.viewportWidth - height: webView.viewportHeight+headerSpace.height + x: -webView.contentX + y: -webView.contentY + width: webView.contentWidth + height: webView.contentHeight+headerSpace.height } Item { id: headerSpace diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml index a7ba1c52ca..8f2655e5a7 100644 --- a/examples/declarative/animations/easing.qml +++ b/examples/declarative/animations/easing.qml @@ -89,7 +89,7 @@ Rectangle { } Flickable { - anchors.fill: parent; viewportHeight: layout.height + anchors.fill: parent; contentHeight: layout.height Column { id: layout anchors.left: parent.left; anchors.right: parent.right diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index f848be0547..b76a9ab0e0 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -81,7 +81,7 @@ Rectangle { Flickable { id: flick anchors.top: methodTitle.bottom; anchors.bottom: parent.bottom - width: parent.width; viewportHeight: methodText.height; clip: true + width: parent.width; contentHeight: methodText.height; clip: true Text { id: methodText; text: method; wrap: true; width: details.width } } Image { @@ -114,7 +114,7 @@ Rectangle { // Make the detailed view fill the entire list area PropertyChanges { target: wrapper; height: list.height } // Move the list so that this item is at the top. - PropertyChanges { target: wrapper.ListView.view; explicit: true; viewportY: wrapper.y } + PropertyChanges { target: wrapper.ListView.view; explicit: true; contentY: wrapper.y } // Disallow flicking while we're in detailed view PropertyChanges { target: wrapper.ListView.view; interactive: false } } @@ -124,7 +124,7 @@ Rectangle { ParallelAnimation { ColorAnimation { property: "color"; duration: 500 } NumberAnimation { - duration: 300; properties: "detailsOpacity,x,viewportY,height,width" + duration: 300; properties: "detailsOpacity,x,contentY,height,width" } } } diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index 811891bf26..5e58100f07 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -10,8 +10,8 @@ Item { Image { id: background fillMode: Image.TileHorizontally - x: -list.viewportX / 2 - width: Math.max(list.viewportWidth, parent.width) + x: -list.contentX / 2 + width: Math.max(list.contentWidth, parent.width) } ListView { diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml index fdd4ca70c6..6530c3de1b 100644 --- a/examples/declarative/progressbar/progressbars.qml +++ b/examples/declarative/progressbar/progressbars.qml @@ -6,7 +6,7 @@ Rectangle { width: 600; height: 405; color: "#edecec" Flickable { - anchors.fill: parent; viewportHeight: column.height + 20 + anchors.fill: parent; contentHeight: column.height + 20 Column { id: column; x: 10; y: 10; spacing: 10 Repeater { diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index a96db6e0c2..84763d21a5 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -12,8 +12,8 @@ Rectangle { source: "pics/niagara_falls.jpg" asynchronous: true } - viewportWidth: picture.width - viewportHeight: picture.height + contentWidth: picture.width + contentHeight: picture.height // Only show the scrollbars when the view is moving. states: [ State { diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml index 50d69d8f08..0d1881e84a 100644 --- a/examples/declarative/velocity/velocity.qml +++ b/examples/declarative/velocity/velocity.qml @@ -96,7 +96,7 @@ Rectangle { } Flickable { id: flickable - anchors.fill: parent; viewportWidth: lay.width + anchors.fill: parent; contentWidth: lay.width Row { id: lay Repeater { diff --git a/examples/declarative/webview/qdeclarative-in-html.qml b/examples/declarative/webview/qdeclarative-in-html.qml index a2f2f2a035..77180ec18e 100644 --- a/examples/declarative/webview/qdeclarative-in-html.qml +++ b/examples/declarative/webview/qdeclarative-in-html.qml @@ -6,8 +6,8 @@ Rectangle { Flickable { width: parent.width height: parent.height/2 - viewportWidth: web.width*web.scale - viewportHeight: web.height*web.scale + contentWidth: web.width*web.scale + contentHeight: web.height*web.scale WebView { id: web width: 250 diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index cf1080b435..25e008824e 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,6 +1,11 @@ ============================================================================= The changes below are pre Qt 4.7.0 alpha +Flickable: renamed viewportWidth -> contentWidth +Flickable: renamed viewportHeight -> contentHeight +Flickable: renamed viewportX -> contentX +Flickable: renamed viewportY -> contentY +Removed Flickable.reportedVelocitySmoothing Renamed MouseRegion -> MouseArea QmlView diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 9f19f531a8..3e595f18a1 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -142,8 +142,8 @@ void QDeclarativeFlickablePrivate::init() QObject::connect(&timeline, SIGNAL(completed()), q, SLOT(movementEnding())); q->setAcceptedMouseButtons(Qt::LeftButton); q->setFiltersChildEvents(true); - QObject::connect(viewport, SIGNAL(xChanged()), q, SIGNAL(positionXChanged())); - QObject::connect(viewport, SIGNAL(yChanged()), q, SIGNAL(positionYChanged())); + QObject::connect(viewport, SIGNAL(xChanged()), q, SIGNAL(contentXChanged())); + QObject::connect(viewport, SIGNAL(yChanged()), q, SIGNAL(contentYChanged())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(heightChange())); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(widthChange())); } @@ -343,7 +343,7 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \code Flickable { - width: 200; height: 200; viewportWidth: image.width; viewportHeight: image.height + width: 200; height: 200; contentWidth: image.width; contentHeight: image.height Image { id: image; source: "bigimage.png" } } \endcode @@ -429,20 +429,20 @@ QDeclarativeFlickable::~QDeclarativeFlickable() } /*! - \qmlproperty int Flickable::viewportX - \qmlproperty int Flickable::viewportY + \qmlproperty int Flickable::contentX + \qmlproperty int Flickable::contentY These properties hold the surface coordinate currently at the top-left corner of the Flickable. For example, if you flick an image up 100 pixels, - \c yPosition will be 100. + \c contentY will be 100. */ -qreal QDeclarativeFlickable::viewportX() const +qreal QDeclarativeFlickable::contentX() const { Q_D(const QDeclarativeFlickable); return -d->_moveX.value(); } -void QDeclarativeFlickable::setViewportX(qreal pos) +void QDeclarativeFlickable::setContentX(qreal pos) { Q_D(QDeclarativeFlickable); pos = qRound(pos); @@ -454,13 +454,13 @@ void QDeclarativeFlickable::setViewportX(qreal pos) } } -qreal QDeclarativeFlickable::viewportY() const +qreal QDeclarativeFlickable::contentY() const { Q_D(const QDeclarativeFlickable); return -d->_moveY.value(); } -void QDeclarativeFlickable::setViewportY(qreal pos) +void QDeclarativeFlickable::setContentY(qreal pos) { Q_D(QDeclarativeFlickable); pos = qRound(pos); @@ -506,12 +506,10 @@ void QDeclarativeFlickable::setInteractive(bool interactive) /*! \qmlproperty real Flickable::horizontalVelocity \qmlproperty real Flickable::verticalVelocity - \qmlproperty real Flickable::reportedVelocitySmoothing The instantaneous velocity of movement along the x and y axes, in pixels/sec. The reported velocity is smoothed to avoid erratic output. - reportedVelocitySmoothing determines how much smoothing is applied. */ qreal QDeclarativeFlickable::horizontalVelocity() const { @@ -584,8 +582,8 @@ QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea() \list \o AutoFlickDirection (default) - allows flicking vertically if the - \e viewportHeight is not equal to the \e height of the Flickable. - Allows flicking horizontally if the \e viewportWidth is not equal + \e contentHeight is not equal to the \e height of the Flickable. + Allows flicking horizontally if the \e contentWidth is not equal to the \e width of the Flickable. \o HorizontalFlick - allows flicking horizontally. \o VerticalFlick - allows flicking vertically. @@ -992,26 +990,26 @@ void QDeclarativeFlickable::setOverShoot(bool o) } /*! - \qmlproperty int Flickable::viewportWidth - \qmlproperty int Flickable::viewportHeight + \qmlproperty int Flickable::contentWidth + \qmlproperty int Flickable::contentHeight The dimensions of the viewport (the surface controlled by Flickable). Typically this should be set to the combined size of the items placed in the Flickable. \code Flickable { - width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height + width: 320; height: 480; contentWidth: image.width; contentHeight: image.height Image { id: image; source: "bigimage.png" } } \endcode */ -qreal QDeclarativeFlickable::viewportWidth() const +qreal QDeclarativeFlickable::contentWidth() const { Q_D(const QDeclarativeFlickable); return d->vWidth; } -void QDeclarativeFlickable::setViewportWidth(qreal w) +void QDeclarativeFlickable::setContentWidth(qreal w) { Q_D(QDeclarativeFlickable); if (d->vWidth == w) @@ -1024,7 +1022,7 @@ void QDeclarativeFlickable::setViewportWidth(qreal w) // Make sure that we're entirely in view. if (!d->pressed) d->fixupX(); - emit viewportWidthChanged(); + emit contentWidthChanged(); d->updateBeginningEnd(); } @@ -1033,7 +1031,7 @@ void QDeclarativeFlickable::widthChange() Q_D(QDeclarativeFlickable); if (d->vWidth < 0) { d->viewport->setWidth(width()); - emit viewportWidthChanged(); + emit contentWidthChanged(); } d->updateBeginningEnd(); } @@ -1043,18 +1041,18 @@ void QDeclarativeFlickable::heightChange() Q_D(QDeclarativeFlickable); if (d->vHeight < 0) { d->viewport->setHeight(height()); - emit viewportHeightChanged(); + emit contentHeightChanged(); } d->updateBeginningEnd(); } -qreal QDeclarativeFlickable::viewportHeight() const +qreal QDeclarativeFlickable::contentHeight() const { Q_D(const QDeclarativeFlickable); return d->vHeight; } -void QDeclarativeFlickable::setViewportHeight(qreal h) +void QDeclarativeFlickable::setContentHeight(qreal h) { Q_D(QDeclarativeFlickable); if (d->vHeight == h) @@ -1067,7 +1065,7 @@ void QDeclarativeFlickable::setViewportHeight(qreal h) // Make sure that we're entirely in view. if (!d->pressed) d->fixupY(); - emit viewportHeightChanged(); + emit contentHeightChanged(); d->updateBeginningEnd(); } @@ -1259,22 +1257,6 @@ void QDeclarativeFlickable::setPressDelay(int delay) emit pressDelayChanged(); } -qreal QDeclarativeFlickable::reportedVelocitySmoothing() const -{ - Q_D(const QDeclarativeFlickable); - return d->reportedVelocitySmoothing; -} - -void QDeclarativeFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) -{ - Q_D(QDeclarativeFlickable); - Q_ASSERT(reportedVelocitySmoothing >= 0); - if (reportedVelocitySmoothing == d->reportedVelocitySmoothing) - return; - d->reportedVelocitySmoothing = reportedVelocitySmoothing; - emit reportedVelocitySmoothingChanged(reportedVelocitySmoothing); -} - /*! \qmlproperty bool Flickable::moving diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index 19fb2a9d0a..46176884f7 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -56,14 +56,13 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem { Q_OBJECT - Q_PROPERTY(qreal viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged) - Q_PROPERTY(qreal viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged) - Q_PROPERTY(qreal viewportX READ viewportX WRITE setViewportX NOTIFY positionXChanged) - Q_PROPERTY(qreal viewportY READ viewportY WRITE setViewportY NOTIFY positionYChanged) + Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged) + Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged) + Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged) + Q_PROPERTY(qreal contentY READ contentY WRITE setContentY NOTIFY contentYChanged) Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) - Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged) Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot NOTIFY overShootChanged) Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) @@ -98,17 +97,17 @@ public: bool overShoot() const; void setOverShoot(bool); - qreal viewportWidth() const; - void setViewportWidth(qreal); + qreal contentWidth() const; + void setContentWidth(qreal); - qreal viewportHeight() const; - void setViewportHeight(qreal); + qreal contentHeight() const; + void setContentHeight(qreal); - qreal viewportX() const; - void setViewportX(qreal pos); + qreal contentX() const; + void setContentX(qreal pos); - qreal viewportY() const; - void setViewportY(qreal pos); + qreal contentY() const; + void setContentY(qreal pos); bool isMoving() const; bool isFlicking() const; @@ -116,9 +115,6 @@ public: int pressDelay() const; void setPressDelay(int delay); - qreal reportedVelocitySmoothing() const; - void setReportedVelocitySmoothing(qreal); - qreal maximumFlickVelocity() const; void setMaximumFlickVelocity(qreal); @@ -143,17 +139,16 @@ public: void setFlickDirection(FlickDirection); Q_SIGNALS: - void viewportWidthChanged(); - void viewportHeightChanged(); - void positionXChanged(); - void positionYChanged(); + void contentWidthChanged(); + void contentHeightChanged(); + void contentXChanged(); + void contentYChanged(); void movingChanged(); void flickingChanged(); void movementStarted(); void movementEnded(); void flickStarted(); void flickEnded(); - void reportedVelocitySmoothingChanged(int); void horizontalVelocityChanged(); void verticalVelocityChanged(); void isAtBoundaryChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index ab5022b78d..0a103f37c5 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -133,14 +133,14 @@ public: qreal position() const { Q_Q(const QDeclarativeGridView); - return flow == QDeclarativeGridView::LeftToRight ? q->viewportY() : q->viewportX(); + return flow == QDeclarativeGridView::LeftToRight ? q->contentY() : q->contentX(); } void setPosition(qreal pos) { Q_Q(QDeclarativeGridView); if (flow == QDeclarativeGridView::LeftToRight) - q->setViewportY(pos); + q->setContentY(pos); else - q->setViewportX(pos); + q->setContentX(pos); } int size() const { Q_Q(const QDeclarativeGridView); @@ -458,9 +458,9 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) } if (changed) { if (flow == QDeclarativeGridView::LeftToRight) - q->setViewportHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition()); else - q->setViewportWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition()); } else if (!doBuffer && buffer && bufferMode != NoBuffer) { refill(from, to, true); } @@ -473,9 +473,9 @@ void QDeclarativeGridViewPrivate::updateGrid() columns = (int)qMax((flow == QDeclarativeGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.)); if (isValid()) { if (flow == QDeclarativeGridView::LeftToRight) - q->setViewportHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition()); else - q->setViewportWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition()); } } @@ -516,10 +516,10 @@ void QDeclarativeGridViewPrivate::layout(bool removed) updateHighlight(); moveReason = Other; if (flow == QDeclarativeGridView::LeftToRight) { - q->setViewportHeight(endPosition() - startPosition()); + q->setContentHeight(endPosition() - startPosition()); fixupY(); } else { - q->setViewportWidth(endPosition() - startPosition()); + q->setContentWidth(endPosition() - startPosition()); fixupX(); } updateUnrequestedPositions(); @@ -1028,10 +1028,10 @@ void QDeclarativeGridView::setFlow(Flow flow) if (d->flow != flow) { d->flow = flow; if (d->flow == LeftToRight) { - setViewportWidth(-1); + setContentWidth(-1); setFlickDirection(QDeclarativeFlickable::VerticalFlick); } else { - setViewportHeight(-1); + setContentHeight(-1); setFlickDirection(QDeclarativeFlickable::HorizontalFlick); } d->clear(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index e6b6f2af0b..64210182f8 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -203,14 +203,14 @@ public: qreal position() const { Q_Q(const QDeclarativeListView); - return orient == QDeclarativeListView::Vertical ? q->viewportY() : q->viewportX(); + return orient == QDeclarativeListView::Vertical ? q->contentY() : q->contentX(); } void setPosition(qreal pos) { Q_Q(QDeclarativeListView); if (orient == QDeclarativeListView::Vertical) - q->setViewportY(pos); + q->setContentY(pos); else - q->setViewportX(pos); + q->setContentX(pos); } qreal size() const { Q_Q(const QDeclarativeListView); @@ -382,9 +382,9 @@ public: void updateViewport() { Q_Q(QDeclarativeListView); if (orient == QDeclarativeListView::Vertical) { - q->setViewportHeight(endPosition() - startPosition() + 1); + q->setContentHeight(endPosition() - startPosition() + 1); } else { - q->setViewportWidth(endPosition() - startPosition() + 1); + q->setContentWidth(endPosition() - startPosition() + 1); } } @@ -1819,10 +1819,10 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie if (d->orient != orientation) { d->orient = orientation; if (d->orient == QDeclarativeListView::Vertical) { - setViewportWidth(-1); + setContentWidth(-1); setFlickDirection(VerticalFlick); } else { - setViewportHeight(-1); + setContentHeight(-1); setFlickDirection(HorizontalFlick); } d->clear(); diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml index 3e08359f08..4b82d5c4e5 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml @@ -2,7 +2,7 @@ import Qt 4.6 Flickable { width: 100; height: 100 - viewportWidth: row.width; viewportHeight: row.height + contentWidth: row.width; contentHeight: row.height Row { id: row diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml index 3ed173d53a..49eed5a299 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml @@ -2,7 +2,7 @@ import Qt 4.6 Flickable { width: 100; height: 100 - viewportWidth: column.width; viewportHeight: column.height + contentWidth: column.width; contentHeight: column.height Column { id: column diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml index 1425d85b93..40c4606e2b 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml @@ -2,7 +2,7 @@ import Qt 4.6 Flickable { width: 100; height: 100 - viewportWidth: column.width; viewportHeight: column.height + contentWidth: column.width; contentHeight: column.height pressDelay: 200; overShoot: false; interactive: false maximumFlickVelocity: 2000 diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 1c98c5005f..cb87977f04 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -81,12 +81,11 @@ void tst_qdeclarativeflickable::create() QCOMPARE(obj->isAtXEnd(), false); QCOMPARE(obj->isAtYBeginning(), true); QCOMPARE(obj->isAtYEnd(), false); - QCOMPARE(obj->viewportX(), 0.); - QCOMPARE(obj->viewportY(), 0.); + QCOMPARE(obj->contentX(), 0.); + QCOMPARE(obj->contentY(), 0.); QCOMPARE(obj->horizontalVelocity(), 0.); QCOMPARE(obj->verticalVelocity(), 0.); - QCOMPARE(obj->reportedVelocitySmoothing(), 100.); QCOMPARE(obj->isInteractive(), true); QCOMPARE(obj->overShoot(), true); @@ -103,8 +102,8 @@ void tst_qdeclarativeflickable::horizontalViewportSize() QDeclarativeFlickable *obj = qobject_cast<QDeclarativeFlickable*>(c.create()); QVERIFY(obj != 0); - QCOMPARE(obj->viewportWidth(), 800.); - QCOMPARE(obj->viewportHeight(), 300.); + QCOMPARE(obj->contentWidth(), 800.); + QCOMPARE(obj->contentHeight(), 300.); QCOMPARE(obj->isAtXBeginning(), true); QCOMPARE(obj->isAtXEnd(), false); QCOMPARE(obj->isAtYBeginning(), true); @@ -120,8 +119,8 @@ void tst_qdeclarativeflickable::verticalViewportSize() QDeclarativeFlickable *obj = qobject_cast<QDeclarativeFlickable*>(c.create()); QVERIFY(obj != 0); - QCOMPARE(obj->viewportWidth(), 200.); - QCOMPARE(obj->viewportHeight(), 1200.); + QCOMPARE(obj->contentWidth(), 200.); + QCOMPARE(obj->contentHeight(), 1200.); QCOMPARE(obj->isAtXBeginning(), true); QCOMPARE(obj->isAtXEnd(), false); QCOMPARE(obj->isAtYBeginning(), true); diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 9c9d1d3d4f..2a60feef16 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -298,14 +298,14 @@ void tst_QDeclarativeGridView::inserted() model.insertItem(i, "Hello", QString::number(i)); QTest::qWait(300); - gridview->setViewportY(120); + gridview->setContentY(120); QTest::qWait(300); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); QTest::qWait(300); - QVERIFY(gridview->viewportY() == 120); + QVERIFY(gridview->contentY() == 120); delete canvas; } @@ -392,7 +392,7 @@ void tst_QDeclarativeGridView::removed() } // Remove items before visible - gridview->setViewportY(120); + gridview->setContentY(120); QTest::qWait(500); gridview->setCurrentIndex(10); @@ -400,7 +400,7 @@ void tst_QDeclarativeGridView::removed() QTest::qWait(300); // Setting currentIndex above shouldn't cause view to scroll - QCOMPARE(gridview->viewportY(), 120.0); + QCOMPARE(gridview->contentY(), 120.0); model.removeItem(1); @@ -424,7 +424,7 @@ void tst_QDeclarativeGridView::removed() QCOMPARE(gridview->currentIndex(), 9); QVERIFY(gridview->currentItem() != oldCurrent); - gridview->setViewportY(0); + gridview->setContentY(0); // let transitions settle. QTest::qWait(300); @@ -441,7 +441,7 @@ void tst_QDeclarativeGridView::removed() // remove item outside current view. gridview->setCurrentIndex(32); QTest::qWait(500); - gridview->setViewportY(240); + gridview->setContentY(240); model.removeItem(30); QVERIFY(gridview->currentIndex() == 31); @@ -449,7 +449,7 @@ void tst_QDeclarativeGridView::removed() // remove current item beyond visible items. gridview->setCurrentIndex(20); QTest::qWait(500); - gridview->setViewportY(0); + gridview->setContentY(0); model.removeItem(20); QTest::qWait(500); @@ -459,7 +459,7 @@ void tst_QDeclarativeGridView::removed() // remove item before current, but visible gridview->setCurrentIndex(8); QTest::qWait(500); - gridview->setViewportY(240); + gridview->setContentY(240); oldCurrent = gridview->currentItem(); model.removeItem(6); QTest::qWait(500); @@ -520,7 +520,7 @@ void tst_QDeclarativeGridView::moved() QVERIFY(item->y() == (i/3)*60); } - gridview->setViewportY(120); + gridview->setContentY(120); // move outside visible area model.moveItem(1, 25); @@ -638,13 +638,13 @@ void tst_QDeclarativeGridView::currentIndex() QCOMPARE(gridview->currentIndex(), model.count()-1); QTest::qWait(500); - QCOMPARE(gridview->viewportY(), 279.0); + QCOMPARE(gridview->contentY(), 279.0); gridview->moveCurrentIndexRight(); QCOMPARE(gridview->currentIndex(), 0); QTest::qWait(500); - QCOMPARE(gridview->viewportY(), 0.0); + QCOMPARE(gridview->contentY(), 0.0); // Test keys qApp->setActiveWindow(canvas); @@ -829,7 +829,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position on a currently visible item gridview->positionViewAtIndex(4); - QCOMPARE(gridview->viewportY(), 60.); + QCOMPARE(gridview->contentY(), 60.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); @@ -843,7 +843,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position on an item beyond the visible items gridview->positionViewAtIndex(21); - QCOMPARE(gridview->viewportY(), 420.); + QCOMPARE(gridview->contentY(), 420.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); @@ -857,7 +857,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position on an item that would leave empty space if positioned at the top gridview->positionViewAtIndex(31); - QCOMPARE(gridview->viewportY(), 520.); + QCOMPARE(gridview->contentY(), 520.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); @@ -871,7 +871,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position at the beginning again gridview->positionViewAtIndex(0); - QCOMPARE(gridview->viewportY(), 0.); + QCOMPARE(gridview->contentY(), 0.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 9100522d9a..f15f26bf36 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -486,14 +486,14 @@ void tst_QDeclarativeListView::inserted() model.insertItem(i, "Hello", QString::number(i)); QTest::qWait(500); - listview->setViewportY(80); + listview->setContentY(80); QTest::qWait(500); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); QTest::qWait(500); - QVERIFY(listview->viewportY() == 80); + QVERIFY(listview->contentY() == 80); // Confirm items positioned correctly for (int i = 5; i < 5+15; ++i) { @@ -591,7 +591,7 @@ void tst_QDeclarativeListView::removed(bool animated) } // Remove items before visible - listview->setViewportY(80); + listview->setContentY(80); listview->setCurrentIndex(10); model.removeItem(1); // post: top item will be at 40 @@ -615,7 +615,7 @@ void tst_QDeclarativeListView::removed(bool animated) QCOMPARE(listview->currentIndex(), 9); QVERIFY(listview->currentItem() != oldCurrent); - listview->setViewportY(40); // That's the top now + listview->setContentY(40); // That's the top now // let transitions settle. QTest::qWait(500); @@ -631,7 +631,7 @@ void tst_QDeclarativeListView::removed(bool animated) // remove current item beyond visible items. listview->setCurrentIndex(20); QTest::qWait(500); - listview->setViewportY(40); + listview->setContentY(40); model.removeItem(20); QTest::qWait(500); @@ -682,7 +682,7 @@ void tst_QDeclarativeListView::clear() QVERIFY(listview->count() == 0); QVERIFY(listview->currentItem() == 0); - QVERIFY(listview->viewportY() == 0); + QVERIFY(listview->contentY() == 0); delete canvas; } @@ -740,7 +740,7 @@ void tst_QDeclarativeListView::moved() QVERIFY(item->y() == i*20); } - listview->setViewportY(80); + listview->setContentY(80); // move outside visible area model.moveItem(1, 18); @@ -812,7 +812,7 @@ void tst_QDeclarativeListView::enforceRange() // view should be positioned at the top of the range. QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 0); QVERIFY(item); - QCOMPARE(listview->viewportY(), -100.0); + QCOMPARE(listview->contentY(), -100.0); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 0); QVERIFY(name != 0); @@ -822,7 +822,7 @@ void tst_QDeclarativeListView::enforceRange() QCOMPARE(number->text(), model.number(0)); // Check currentIndex is updated when viewport moves - listview->setViewportY(20); + listview->setContentY(20); QTest::qWait(500); QCOMPARE(listview->currentIndex(), 6); @@ -948,10 +948,10 @@ void tst_QDeclarativeListView::sections() QCOMPARE(listview->currentSection(), QString("0")); - listview->setViewportY(140); + listview->setContentY(140); QCOMPARE(listview->currentSection(), QString("1")); - listview->setViewportY(20); + listview->setContentY(20); QCOMPARE(listview->currentSection(), QString("0")); item = findItem<QDeclarativeItem>(viewport, "wrapper", 1); @@ -1012,13 +1012,13 @@ void tst_QDeclarativeListView::currentIndex() QCOMPARE(listview->currentIndex(), model.count()-1); QTest::qWait(1000); - QCOMPARE(listview->viewportY(), 279.0); + QCOMPARE(listview->contentY(), 279.0); listview->incrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 0); QTest::qWait(1000); - QCOMPARE(listview->viewportY(), 0.0); + QCOMPARE(listview->contentY(), 0.0); // Test keys canvas->show(); @@ -1181,7 +1181,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() // Position on a currently visible item listview->positionViewAtIndex(3); - QCOMPARE(listview->viewportY(), 60.); + QCOMPARE(listview->contentY(), 60.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); @@ -1194,7 +1194,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() // Position on an item beyond the visible items listview->positionViewAtIndex(22); - QCOMPARE(listview->viewportY(), 440.); + QCOMPARE(listview->contentY(), 440.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); @@ -1207,7 +1207,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() // Position on an item that would leave empty space if positioned at the top listview->positionViewAtIndex(28); - QCOMPARE(listview->viewportY(), 480.); + QCOMPARE(listview->contentY(), 480.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); @@ -1220,7 +1220,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() // Position at the beginning again listview->positionViewAtIndex(0); - QCOMPARE(listview->viewportY(), 0.); + QCOMPARE(listview->contentY(), 0.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); diff --git a/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml index 1a7366d341..50ba9ad962 100644 --- a/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml +++ b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml @@ -17,7 +17,7 @@ Rectangle { Flickable { id: flickable - anchors.fill: parent; viewportWidth: row.width + anchors.fill: parent; contentWidth: row.width Row { id: row diff --git a/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml index 6204aa9185..ebb963dc6a 100644 --- a/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml +++ b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml @@ -18,7 +18,7 @@ Rectangle { flickable { id: flick height: parent.height-50 - width: parent.width; viewportHeight: column.height + width: parent.width; contentHeight: column.height Column { id: column |