From 5912a8bc5d59d4eb9d154c9b0a4ad495fe465c13 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 1 Dec 2009 08:37:42 +1000 Subject: doc fix --- doc/src/declarative/qmlmodels.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/declarative/qmlmodels.qdoc b/doc/src/declarative/qmlmodels.qdoc index a14345b..2dc24fe 100644 --- a/doc/src/declarative/qmlmodels.qdoc +++ b/doc/src/declarative/qmlmodels.qdoc @@ -101,7 +101,7 @@ ListModel { \endcode The above model has two roles, \e name and \e cost. These can be bound -bound to by a ListView delegate, for example: +to by a ListView delegate, for example: \code Component { -- cgit v0.12 From 3c115a2f574ffc54a1f629e365def931133d286a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 1 Dec 2009 13:38:38 +1000 Subject: Cleanup orientation stuff. --- tools/qmlviewer/qmlviewer.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 8c50b09..98a9702 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -94,31 +94,19 @@ class Screen : public QObject public: Screen(QObject *parent=0) : QObject(parent) { - m_screens.append(this); connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), this, SIGNAL(orientationChanged())); } - ~Screen() { m_screens.removeAll(this); } enum Orientation { UnknownOrientation = DeviceOrientation::UnknownOrientation, Portrait = DeviceOrientation::Portrait, Landscape = DeviceOrientation::Landscape }; Orientation orientation() const { return Orientation(DeviceOrientation::instance()->orientation()); } - static void setOrientation(Orientation orient) { - if (orient != Orientation(DeviceOrientation::instance()->orientation())) { - DeviceOrientation::instance()->setOrientation(DeviceOrientation::Orientation(orient)); - } - } signals: void orientationChanged(); - -private: - static QList m_screens; }; -QList Screen::m_screens; - QML_DECLARE_TYPE(Screen) QML_DEFINE_TYPE(QmlViewer, 1, 0, Screen, Screen) @@ -570,13 +558,13 @@ void QmlViewer::proxySettingsChanged() void QmlViewer::setPortrait() { - Screen::setOrientation(Screen::Portrait); + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); portraitOrientation->setChecked(true); } void QmlViewer::setLandscape() { - Screen::setOrientation(Screen::Landscape); + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); landscapeOrientation->setChecked(true); } -- cgit v0.12 From f36455bc3b559261c73b4f6269591a2eda8d0baa Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 1 Dec 2009 13:45:20 +1000 Subject: Build correct QmlViewer Screen orientation implementation for Maemo. --- tools/qmlviewer/qmlviewer.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro index 4d5effd..91c9534 100644 --- a/tools/qmlviewer/qmlviewer.pro +++ b/tools/qmlviewer/qmlviewer.pro @@ -21,7 +21,7 @@ SOURCES += main.cpp \ qmlviewer.cpp \ proxysettings.cpp \ qfxtester.cpp -maemo: { +maemo5 { SOURCES += deviceorientation_maemo.cpp } else { SOURCES += deviceorientation.cpp -- cgit v0.12 From 88ee1fa39e2f1aff0eac5503ca34274481125b8f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 1 Dec 2009 17:27:49 +1000 Subject: Add header and footer to ListView. --- .../graphicsitems/qmlgraphicslistview.cpp | 133 ++++++++++++++++++++- .../graphicsitems/qmlgraphicslistview_p.h | 9 ++ 2 files changed, 137 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 9dd2ab4..144eed7 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -178,6 +178,7 @@ public: , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0), spacing(0.0) , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QmlGraphicsListView::NoHighlightRange) , snapMode(QmlGraphicsListView::NoSnap), overshootDist(0.0) + , footerComponent(0), footer(0), headerComponent(0), header(0) , ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false) , correctFlick(true) {} @@ -209,7 +210,6 @@ public: } FxListItem *nextVisibleItem() const { - qDebug() << "last vis"; const qreal pos = position(); bool foundFirst = false; for (int i = 0; i < visibleItems.count(); ++i) { @@ -404,9 +404,9 @@ public: void updateViewport() { Q_Q(QmlGraphicsListView); if (orient == QmlGraphicsListView::Vertical) - q->setViewportHeight(endPosition() - startPosition()); + q->setViewportHeight(q->minYExtent() - q->maxYExtent()); else - q->setViewportWidth(endPosition() - startPosition()); + q->setViewportWidth(q->minXExtent() - q->maxXExtent()); } @@ -434,6 +434,8 @@ public: void updateCurrentSection(); void updateCurrent(int); void updateAverage(); + void updateHeader(); + void updateFooter(); void fixupPosition(); virtual void fixupY(); virtual void fixupX(); @@ -469,6 +471,10 @@ public: QmlGraphicsListView::HighlightRangeMode highlightRange; QmlGraphicsListView::SnapMode snapMode; qreal overshootDist; + QmlComponent *footerComponent; + FxListItem *footer; + QmlComponent *headerComponent; + FxListItem *header; bool ownModel : 1; bool wrap : 1; @@ -491,7 +497,7 @@ void QmlGraphicsListViewPrivate::clear() for (int i = 0; i < visibleItems.count(); ++i) releaseItem(visibleItems.at(i)); visibleItems.clear(); - visiblePos = 0; + visiblePos = header ? header->size() : 0; visibleIndex = 0; releaseItem(currentItem); currentItem = 0; @@ -623,6 +629,10 @@ void QmlGraphicsListViewPrivate::refill(qreal from, qreal to) updateAverage(); if (!sectionExpression.isEmpty()) updateCurrentSection(); + if (header) + updateHeader(); + if (footer) + updateFooter(); updateViewport(); } } @@ -647,6 +657,10 @@ void QmlGraphicsListViewPrivate::layout() q->refill(); updateHighlight(); fixupPosition(); + if (header) + updateHeader(); + if (footer) + updateFooter(); updateUnrequestedPositions(); updateViewport(); } @@ -860,6 +874,66 @@ void QmlGraphicsListViewPrivate::updateAverage() averageSize = sum / visibleItems.count(); } +void QmlGraphicsListViewPrivate::updateFooter() +{ + Q_Q(QmlGraphicsListView); + if (!footer && footerComponent) { + QmlGraphicsItem *item = 0; + QmlContext *context = new QmlContext(qmlContext(q)); + QObject *nobj = footerComponent->create(context); + if (nobj) { + context->setParent(nobj); + item = qobject_cast(nobj); + if (!item) + delete nobj; + } else { + delete context; + } + if (item) { + item->setParent(q->viewport()); + item->setZValue(1); + footer = new FxListItem(item, q); + } + } + if (footer) { + if (visibleItems.count()) + footer->setPosition(endPosition()); + else + footer->setPosition(visiblePos); + } +} + +void QmlGraphicsListViewPrivate::updateHeader() +{ + Q_Q(QmlGraphicsListView); + if (!header && headerComponent) { + QmlGraphicsItem *item = 0; + QmlContext *context = new QmlContext(qmlContext(q)); + QObject *nobj = headerComponent->create(context); + if (nobj) { + context->setParent(nobj); + item = qobject_cast(nobj); + if (!item) + delete nobj; + } else { + delete context; + } + if (item) { + item->setParent(q->viewport()); + item->setZValue(1); + header = new FxListItem(item, q); + if (visibleItems.isEmpty()) + visiblePos = header->size(); + } + } + if (header) { + if (visibleItems.count()) + header->setPosition(startPosition() - header->size()); + else + header->setPosition(0); + } +} + void QmlGraphicsListViewPrivate::fixupPosition() { if (orient == QmlGraphicsListView::Vertical) @@ -1759,6 +1833,47 @@ void QmlGraphicsListView::setSnapMode(SnapMode mode) } } +QmlComponent *QmlGraphicsListView::footer() const +{ + Q_D(const QmlGraphicsListView); + return d->footerComponent; +} + +void QmlGraphicsListView::setFooter(QmlComponent *footer) +{ + Q_D(QmlGraphicsListView); + if (d->footerComponent != footer) { + if (d->footer) { + delete d->footer; + d->footer = 0; + } + d->footerComponent = footer; + d->updateFooter(); + d->updateViewport(); + } +} + +QmlComponent *QmlGraphicsListView::header() const +{ + Q_D(const QmlGraphicsListView); + return d->headerComponent; +} + +void QmlGraphicsListView::setHeader(QmlComponent *header) +{ + Q_D(QmlGraphicsListView); + if (d->headerComponent != header) { + if (d->header) { + delete d->header; + d->header = 0; + } + d->headerComponent = header; + d->updateHeader(); + d->updateFooter(); + d->updateViewport(); + } +} + void QmlGraphicsListView::viewportMoved() { Q_D(QmlGraphicsListView); @@ -1813,6 +1928,8 @@ qreal QmlGraphicsListView::minYExtent() const if (d->orient == QmlGraphicsListView::Horizontal) return QmlGraphicsFlickable::minYExtent(); qreal extent = -d->startPosition(); + if (d->header && d->visibleItems.count()) + extent += d->header->size(); if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) extent += d->highlightRangeStart; @@ -1829,6 +1946,8 @@ qreal QmlGraphicsListView::maxYExtent() const extent = -(d->positionAt(count()-1) - d->highlightRangeEnd); else extent = -(d->endPosition() - height() + 1); + if (d->footer) + extent -= d->footer->size(); qreal minY = minYExtent(); if (extent > minY) extent = minY; @@ -1841,6 +1960,8 @@ qreal QmlGraphicsListView::minXExtent() const if (d->orient == QmlGraphicsListView::Vertical) return QmlGraphicsFlickable::minXExtent(); qreal extent = -d->startPosition(); + if (d->header) + extent += d->header->size(); if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) extent += d->highlightRangeStart; @@ -1857,6 +1978,8 @@ qreal QmlGraphicsListView::maxXExtent() const extent = -(d->positionAt(count()-1) - d->highlightRangeEnd); else extent = -(d->endPosition() - width() + 1); + if (d->footer) + extent -= d->footer->size(); qreal minX = minXExtent(); if (extent > minX) extent = minX; @@ -2221,7 +2344,7 @@ void QmlGraphicsListView::itemsRemoved(int modelIndex, int count) if (d->visibleItems.isEmpty()) { d->visibleIndex = 0; - d->visiblePos = 0; + d->visiblePos = d->header ? d->header->size() : 0; d->timeline.clear(); d->setPosition(0); if (d->model->count() == 0) diff --git a/src/declarative/graphicsitems/qmlgraphicslistview_p.h b/src/declarative/graphicsitems/qmlgraphicslistview_p.h index cc74056..241fb05 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicslistview_p.h @@ -84,6 +84,9 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode) + Q_PROPERTY(QmlComponent *header READ header WRITE setHeader) + Q_PROPERTY(QmlComponent *footer READ footer WRITE setFooter) + Q_ENUMS(HighlightRangeMode) Q_ENUMS(Orientation) Q_ENUMS(SnapMode) @@ -149,6 +152,12 @@ public: SnapMode snapMode() const; void setSnapMode(SnapMode mode); + QmlComponent *footer() const; + void setFooter(QmlComponent *); + + QmlComponent *header() const; + void setHeader(QmlComponent *); + static QmlGraphicsListViewAttached *qmlAttachedProperties(QObject *); public Q_SLOTS: -- cgit v0.12 From 22cc7e138d5274db607567c602d57db842309625 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 2 Dec 2009 09:10:16 +1000 Subject: Fix jumpy EaseFollow animations Task-number: QTBUG-5766 --- src/declarative/util/qmleasefollow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/util/qmleasefollow.cpp b/src/declarative/util/qmleasefollow.cpp index b326f63..50758f4 100644 --- a/src/declarative/util/qmleasefollow.cpp +++ b/src/declarative/util/qmleasefollow.cpp @@ -124,7 +124,7 @@ bool QmlEaseFollowPrivate::recalc() vp = velocity; sp = 0; sd = s; - } else if (tf > (maximumEasingTime / 1000.)) { + } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / 1000.)) { qreal met = maximumEasingTime / 1000.; td = tf - met; -- cgit v0.12 From a2420e0650b23aad5daf4f146722d54aa649c77f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 2 Dec 2009 09:40:06 +1000 Subject: Get qsTr and friends working again. --- src/declarative/qml/qmlengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 864d07e..92a6bd9 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -160,6 +160,10 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) scriptEngine.globalObject().setProperty(QLatin1String("createComponent"), scriptEngine.newFunction(QmlEnginePrivate::createComponent, 1)); + // translation functions need to be installed + // before the global script class is constructed (QTBUG-6437) + scriptEngine.installTranslatorFunctions(); + globalClass = new QmlGlobalScriptClass(&scriptEngine); } @@ -227,7 +231,6 @@ void QmlEnginePrivate::init() qRegisterMetaType("QVariant"); qRegisterMetaType("QmlScriptString"); - scriptEngine.installTranslatorFunctions(); contextClass = new QmlContextScriptClass(q); objectClass = new QmlObjectScriptClass(q); valueTypeClass = new QmlValueTypeScriptClass(q); -- cgit v0.12 From 9a747225bba0d645868ef32391f1bed74376ff2c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 2 Dec 2009 10:17:01 +1000 Subject: Allow Flickable direction to be set explicitly. --- .../graphicsitems/qmlgraphicsflickable.cpp | 41 ++++++++++++++++++++-- .../graphicsitems/qmlgraphicsflickable_p.h | 8 +++++ .../graphicsitems/qmlgraphicsflickable_p_p.h | 1 + .../graphicsitems/qmlgraphicsgridview.cpp | 8 +++-- .../graphicsitems/qmlgraphicslistview.cpp | 10 ++++-- 5 files changed, 62 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp index e010081..d827cda 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp @@ -162,6 +162,7 @@ QmlGraphicsFlickablePrivate::QmlGraphicsFlickablePrivate() , interactive(true), deceleration(500), maxVelocity(5000), reportedVelocitySmoothing(100) , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0) , horizontalVelocity(this), verticalVelocity(this), vTime(0), visibleArea(0) + , flickDirection(QmlGraphicsFlickable::AutoFlickDirection) { fixupXEvent = QmlTimeLineEvent::timeLineEvent(&_moveX, this); fixupYEvent = QmlTimeLineEvent::timeLineEvent(&_moveY, this); @@ -576,6 +577,36 @@ QmlGraphicsFlickableVisibleArea *QmlGraphicsFlickable::visibleArea() return d->visibleArea; } +/*! + \qmlproperty enumeration Flickable::flickDirection + + This property determines which directions the view can be flicked. + + \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 + to the \e width of the Flickable. + \o HorizontalFlick - allows flicking horizontally. + \o VerticalFlick - allows flicking vertically. + \o HorizontalAndVerticalFlick - allows flicking in both directions. + \endlist +*/ +QmlGraphicsFlickable::FlickDirection QmlGraphicsFlickable::flickDirection() const +{ + Q_D(const QmlGraphicsFlickable); + return d->flickDirection; +} + +void QmlGraphicsFlickable::setFlickDirection(FlickDirection direction) +{ + Q_D(QmlGraphicsFlickable); + if (direction != d->flickDirection) { + d->flickDirection = direction; + emit flickDirectionChanged(); + } +} + void QmlGraphicsFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) { if (interactive && timeline.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10)) @@ -1039,12 +1070,18 @@ qreal QmlGraphicsFlickable::vHeight() const bool QmlGraphicsFlickable::xflick() const { - return vWidth() != width(); + Q_D(const QmlGraphicsFlickable); + if (d->flickDirection == QmlGraphicsFlickable::AutoFlickDirection) + return vWidth() != width(); + return d->flickDirection & QmlGraphicsFlickable::HorizontalFlick; } bool QmlGraphicsFlickable::yflick() const { - return vHeight() != height(); + Q_D(const QmlGraphicsFlickable); + if (d->flickDirection == QmlGraphicsFlickable::AutoFlickDirection) + return vHeight() != height(); + return d->flickDirection & QmlGraphicsFlickable::VerticalFlick; } bool QmlGraphicsFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h index 50248e1..9610ac1 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h @@ -70,6 +70,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration) Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) + Q_PROPERTY(FlickDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickDirectionChanged) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay) @@ -85,6 +86,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem Q_PROPERTY(QmlList* flickableChildren READ flickableChildren) Q_CLASSINFO("DefaultProperty", "flickableData") + Q_ENUMS(FlickDirection) + public: QmlGraphicsFlickable(QmlGraphicsItem *parent=0); ~QmlGraphicsFlickable(); @@ -135,6 +138,10 @@ public: QmlGraphicsItem *viewport(); + enum FlickDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 }; + FlickDirection flickDirection() const; + void setFlickDirection(FlickDirection); + Q_SIGNALS: void viewportWidthChanged(); void viewportHeightChanged(); @@ -151,6 +158,7 @@ Q_SIGNALS: void verticalVelocityChanged(); void isAtBoundaryChanged(); void pageChanged(); + void flickDirectionChanged(); protected: virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h index 8044ba7..5ccdaad 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h @@ -134,6 +134,7 @@ public: int vTime; QmlTimeLine velocityTimeline; QmlGraphicsFlickableVisibleArea *visibleArea; + QmlGraphicsFlickable::FlickDirection flickDirection; void handleMousePressEvent(QGraphicsSceneMouseEvent *); void handleMouseMoveEvent(QGraphicsSceneMouseEvent *); diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index 81128e7..4e2a366 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -327,6 +327,7 @@ void QmlGraphicsGridViewPrivate::init() q->setFlag(QGraphicsItem::ItemIsFocusScope); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(sizeChange())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(sizeChange())); + q->setFlickDirection(QmlGraphicsFlickable::VerticalFlick); } void QmlGraphicsGridViewPrivate::clear() @@ -1014,10 +1015,13 @@ void QmlGraphicsGridView::setFlow(Flow flow) Q_D(QmlGraphicsGridView); if (d->flow != flow) { d->flow = flow; - if (d->flow == LeftToRight) + if (d->flow == LeftToRight) { setViewportWidth(-1); - else + setFlickDirection(QmlGraphicsFlickable::VerticalFlick); + } else { setViewportHeight(-1); + setFlickDirection(QmlGraphicsFlickable::HorizontalFlick); + } d->clear(); d->updateGrid(); refill(); diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 144eed7..6958f7f 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -490,6 +490,7 @@ void QmlGraphicsListViewPrivate::init() QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(refill())); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(refill())); QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped())); + q->setFlickDirection(QmlGraphicsFlickable::VerticalFlick); } void QmlGraphicsListViewPrivate::clear() @@ -1667,10 +1668,13 @@ void QmlGraphicsListView::setOrientation(QmlGraphicsListView::Orientation orient Q_D(QmlGraphicsListView); if (d->orient != orientation) { d->orient = orientation; - if (d->orient == QmlGraphicsListView::Vertical) + if (d->orient == QmlGraphicsListView::Vertical) { setViewportWidth(-1); - else + setFlickDirection(VerticalFlick); + } else { setViewportHeight(-1); + setFlickDirection(HorizontalFlick); + } d->clear(); refill(); emit orientationChanged(); @@ -2131,6 +2135,8 @@ void QmlGraphicsListView::trackedPositionChanged() pos = d->startPosition(); } else if (d->trackedItem->endPosition() > d->endPosition() - d->size() + d->highlightRangeEnd) { pos = d->endPosition() - d->size(); + if (pos < d->startPosition()) + pos = d->startPosition(); } else { if (trackedPos < viewPos + d->highlightRangeStart) { pos = trackedPos - d->highlightRangeStart; -- cgit v0.12