Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

This commit is contained in:
Simon Hausmann 2013-12-24 10:33:07 +01:00 committed by The Qt Project
commit 751fa46df9
44 changed files with 177 additions and 120 deletions

View File

@ -173,7 +173,7 @@ Rectangle {
text: "go to /tmp"
anchors.verticalCenter: parent.verticalCenter
// TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet.
onClicked: fileDialog.folder = "/tmp" // file:///tmp would also be OK
onClicked: fileDialog.folder = (Qt.platform.os === "windows" ? "/c:/temp" : "/tmp")
}
}
}

View File

@ -78,10 +78,10 @@ Rectangle {
text: "Some hearts<img src=\"images/heart200.png\" width=\"20\" height=\"20\" align=\"bottom\"><img src=\"images/heart200.png\" width=\"30\" height=\"30\" align=\"bottom\"> <img src=\"images/heart200.png\" width=\"40\" height=\"40\"><img src=\"images/heart200.png\" width=\"50\" height=\"50\" align=\"bottom\">with different sizes."
}
TextWithImage {
text: "Resized image<img width=\"80\" height=\"76\" align=\"middle\" src=\"http://files.app4mobile.com/wp-content/uploads/2011/08/nokia-n9-price-specification-features-us-europe-india.jpg\">from the internet."
text: "Resized image<img width=\"48\" height=\"48\" align=\"middle\" src=\"http://qt-project.org/images/qt13a/Qt-logo.png\">from the internet."
}
TextWithImage {
text: "Image<img align=\"middle\" src=\"http://qt.gitorious.org/images/sites/qt/logo.png\">from the internet."
text: "Image<img align=\"middle\" src=\"http://qt-project.org/images/qt13a/Qt-logo.png\">from the internet."
}
TextWithImage {
height: 120

View File

@ -80,10 +80,10 @@ Item {
Text { text: Screen.width + "x" + Screen.height }
Text { text: "pixel density" }
Text { text: Screen.pixelDensity.toFixed(2) + " dots/mm" }
Text { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
Text { text: "logical pixel density" }
Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm" }
Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
Text { text: "available virtual desktop" }
Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }

View File

@ -47,7 +47,7 @@ QtObject {
property SystemPalette palette: SystemPalette { }
property var controlWindow: Window {
width: 400
width: visibilityLabel.implicitWidth * 1.2
height: col.implicitHeight + defaultSpacing * 2
color: palette.window
title: "Control Window"
@ -122,6 +122,7 @@ QtObject {
return "unknown";
}
Text {
id: visibilityLabel
text: "second window is " + (testWindow.visible ? "visible" : "invisible") +
" and has visibility " + parent.visibilityToString(testWindow.visibility)
}

View File

@ -267,7 +267,7 @@ template<typename T> inline T clampTo(double value, T min = defaultMinimumForCla
return min;
return static_cast<T>(value);
}
template<> inline long long int clampTo(double, long long int, long long int); // clampTo does not support long long ints.
template<> long long int clampTo(double, long long int, long long int); // clampTo does not support long long ints.
inline int clampToInteger(double value)
{

View File

@ -62,7 +62,9 @@ QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent)
, m_contentItem(0)
, m_windowDecoration(0)
, m_hasNativeWindows(QGuiApplicationPrivate::platformIntegration()->
hasCapability(QPlatformIntegration::MultipleWindows))
hasCapability(QPlatformIntegration::MultipleWindows) &&
QGuiApplicationPrivate::platformIntegration()->
hasCapability(QPlatformIntegration::WindowManagement))
, m_hasAspiredPosition(false)
{
}

View File

@ -10,27 +10,10 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
exists("qqml_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
LIBS += -lgcov
LIBS_PRIVATE += -lgcov
}
MODULE = quickparticles
load(qt_module)
include(particles.pri)
mac {
# FIXME: this is a workaround for broken qmake logic in qtAddModule()
# This function refuses to use frameworks unless the framework exists on
# the filesystem at the time qmake is run, resulting in a build failure
# if QtQuick is qmaked before QtQml is built and frameworks are
# in use. qtAddLibrary() contains correct logic to deal with this, so
# we'll explicitly call that for now.
load(qt)
LIBS -= -lQtQml # in non-framework builds, these should be re-added
LIBS -= -lQtQml_debug # within the qtAddLibrary if appropriate, so no
qtAddLibrary(QtQml) # harm done :)
LIBS -= -lQtQuick
LIBS -= -lQtQuick_debug
qtAddLibrary(QtQuick)
}

View File

@ -2330,7 +2330,7 @@ void splitCriticalEdges(Function *f)
// (see for example section 4 (Lifetime Analysis) of [Wimmer1]). This algorithm makes sure that the
// blocks of a group are scheduled together, with no non-loop blocks in between. This applies
// recursively for nested loops. It also schedules groups of if-then-else-endif blocks together for
// the smae reason.
// the same reason.
class BlockScheduler
{
Function *function;
@ -2357,15 +2357,15 @@ class BlockScheduler
if (emitted.alreadyProcessed(in))
continue;
// this is a loop, where there in -> candidate edge is the jump back to the top of the loop.
if (dominatorTree.dominates(candidate, in))
// this is a loop, where there in -> candidate edge is the jump back to the top of the loop.
continue;
return false; // an incoming edge that is not yet emitted, and is not a back-edge
}
// postpone everything, and schedule the loop first.
if (candidate->isGroupStart()) {
// postpone everything, and schedule the loop first.
postponedGroups.push(currentGroup);
currentGroup = WorkForGroup(candidate);
}
@ -2389,6 +2389,7 @@ class BlockScheduler
return next;
}
Q_UNREACHABLE();
return 0;
}
@ -3476,11 +3477,11 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine)
// block scheduling, so remove those now.
// qout << "Cleaning up unreachable basic blocks..." << endl;
cleanupBasicBlocks(function, false);
showMeTheCode(function);
// showMeTheCode(function);
// qout << "Doing block scheduling..." << endl;
startEndLoops = BlockScheduler(function, df).go();
showMeTheCode(function);
// showMeTheCode(function);
#ifndef QT_NO_DEBUG
checkCriticalEdges(function->basicBlocks);
@ -3750,3 +3751,10 @@ MoveMapping::Action MoveMapping::schedule(const Move &m, QList<Move> &todo, QLis
// References:
// [Wimmer1] C. Wimmer and M. Franz. Linear Scan Register Allocation on SSA Form. In Proceedings of
// CGO10, ACM Press, 2010
// [Wimmer2] C. Wimmer and H. Mossenbock. Optimized Interval Splitting in a Linear Scan Register
// Allocator. In Proceedings of the ACM/USENIX International Conference on Virtual
// Execution Environments, pages 132141. ACM Press, 2005.
// [Briggs] P. Briggs, K.D. Cooper, T.J. Harvey, and L.T. Simpson. Practical Improvements to the
// Construction and Destruction of Static Single Assignment Form.
// [Appel] A.W. Appel. Modern Compiler Implementation in Java. Second edition, Cambridge
// University Press.

View File

@ -76,6 +76,7 @@
#if USE(PTHREADS)
# include <pthread.h>
# include <sys/resource.h>
#endif
QT_BEGIN_NAMESPACE
@ -113,6 +114,15 @@ quintptr getStackLimit()
pthread_attr_getstack(&attr, &stackBottom, &stackSize);
pthread_attr_destroy(&attr);
# if defined(Q_OS_ANDROID)
// Bionic pretends that the main thread has a tiny stack; work around it
if (gettid() == getpid()) {
rlimit limit;
getrlimit(RLIMIT_STACK, &limit);
stackBottom = reinterpret_cast<void*>(reinterpret_cast<quintptr>(stackBottom) + stackSize - limit.rlim_cur);
}
# endif
stackLimit = reinterpret_cast<quintptr>(stackBottom);
# endif
// This is wrong. StackLimit is the currently committed stack size, not the real end.

View File

@ -13,7 +13,7 @@ MODULE_PLUGIN_TYPES = \
exists("qqml_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
LIBS += -lgcov
LIBS_PRIVATE += -lgcov
}
QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf

View File

@ -179,15 +179,17 @@ void QQmlThreadPrivate::threadEvent()
{
lock();
if (m_shutdown) {
quit();
wakeOne();
unlock();
q->shutdownThread();
} else {
m_threadProcessing = true;
for (;;) {
if (m_shutdown) {
quit();
wakeOne();
unlock();
q->shutdownThread();
return;
} else if (!threadList.isEmpty()) {
m_threadProcessing = true;
while (!threadList.isEmpty()) {
QQmlThread::Message *message = threadList.first();
unlock();
@ -197,13 +199,15 @@ void QQmlThreadPrivate::threadEvent()
lock();
delete threadList.takeFirst();
} else {
wakeOne();
m_threadProcessing = false;
unlock();
return;
}
wakeOne();
m_threadProcessing = false;
unlock();
}
}
@ -228,8 +232,11 @@ void QQmlThread::shutdown()
d->lock();
Q_ASSERT(!d->m_shutdown);
d->m_shutdown = true;
if (d->threadList.isEmpty() && d->m_threadProcessing == false)
if (d->threadList.isEmpty() && d->m_threadProcessing == false) {
d->triggerThreadEvent();
} else if (d->mainSync) {
d->wakeOne();
}
d->wait();
d->unlock();
d->QThread::wait();
@ -333,8 +340,14 @@ void QQmlThread::internalCallMethodInMain(Message *message)
d->triggerMainEvent();
}
while (d->mainSync && !d->m_shutdown)
while (d->mainSync) {
if (d->m_shutdown) {
delete d->mainSync;
d->mainSync = 0;
break;
}
d->wait();
}
d->unlock();
}

View File

@ -1508,11 +1508,11 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru
Here is an example that uses WorkerScript to periodically append the
current time to a list model:
\snippet quick/threading/threadedlistmodel/timedisplay.qml 0
\snippet ../quick/threading/threadedlistmodel/timedisplay.qml 0
The included file, \tt dataloader.js, looks like this:
\snippet quick/threading/threadedlistmodel/dataloader.js 0
\snippet ../quick/threading/threadedlistmodel/dataloader.js 0
The timer in the main example sends messages to the worker script by calling
\l WorkerScript::sendMessage(). When this message is received,

View File

@ -4,6 +4,10 @@ DEFINES += QT_NO_URL_CAST_FROM_STRING
QT = core
QT_PRIVATE = testlib-private quick qml-private gui core-private
# Testlib is only a private dependency, which results in our users not
# inheriting CONFIG+=console transitively. Make it explicit.
MODULE_CONFIG = console
!contains(QT_CONFIG, no-widgets) {
QT += widgets
DEFINES += QT_QMLTEST_WITH_WIDGETS

View File

@ -246,8 +246,8 @@ QML Lists and Models
The \l{Qt QML Models QML Types}{Qt QML Models} submodule provides the types for
structuring data with models and lists.
\list
\li \l ListModel - Defines a list of data
\li \l ListElement - Defines a data item in a \l ListModel
\li \l{ListModel} - Defines a list of data
\li \l{ListElement} - Defines a data item in a \l{ListModel}
\endlist
These QML types are part of Qt Quick for backwards compatibility, but for

View File

@ -350,6 +350,7 @@ void QQuickBorderImage::load()
}
/*!
\qmlpropertygroup QtQuick::BorderImage::border
\qmlproperty int QtQuick::BorderImage::border.left
\qmlproperty int QtQuick::BorderImage::border.right
\qmlproperty int QtQuick::BorderImage::border.top

View File

@ -507,24 +507,23 @@ void QQuickDragAttached::setProposedAction(Qt::DropAction action)
}
/*!
\qmlattachedproperty enumeration QtQuick::Drag::dragType
\since 5.2
\qmlattachedproperty enumeration QtQuick::Drag::dragType
\since 5.2
This property indicates whether to automatically start drags, do nothing, or
to use backwards compatible internal drags. The default is to use backwards
compatible internal drags.
This property indicates whether to automatically start drags, do nothing, or
to use backwards compatible internal drags. The default is to use backwards
compatible internal drags.
A drag can also be started manually using \l startDrag.
A drag can also be started manually using \l startDrag.
\list
\li Drag.None - do not start drags automatically
\li Drag.Automatic - start drags automatically
\li Drag.Internal (default) - start backwards compatible drags automatically
\endlist
When using \l Drag.Automatic you should also define \l mimeData and bind the
\active property to the active property of \l MouseArea.drag.
\list
\li Drag.None - do not start drags automatically
\li Drag.Automatic - start drags automatically
\li Drag.Internal (default) - start backwards compatible drags automatically
\endlist
When using \l Drag.Automatic you should also define \l mimeData and bind the
\active property to the active property of \l MouseArea.drag.
*/
QQuickDrag::DragType QQuickDragAttached::dragType() const
@ -622,7 +621,6 @@ void QQuickDragAttached::start(QQmlV4Function *args)
\li Qt.LinkAction Create a link from the source to the target.
\li Qt.IgnoreAction Ignore the action (do nothing with the data).
\endlist
*/
int QQuickDragAttached::drop()
@ -696,17 +694,17 @@ void QQuickDragAttached::cancel()
}
/*!
\qmlsignal QtQuick::DropArea::onDragStarted()
\qmlattachedsignal QtQuick::Drag::onDragStarted()
This handler is called when a drag is started with the \l startDrag method
or when it is started automatically using the \l dragType property.
This handler is called when a drag is started with the \l startDrag method
or when it is started automatically using the \l dragType property.
*/
/*!
\qmlsignal QtQuick::DropArea::onDragFinished(DropAction action)
\qmlattachedsignal QtQuick::Drag::onDragFinished(DropAction action)
This handler is called when a drag finishes and the drag was started with the
\l startDrag method or started automatically using the \l dragType property.
This handler is called when a drag finishes and the drag was started with the
\l startDrag method or started automatically using the \l dragType property.
*/
Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedActions)

View File

@ -193,6 +193,7 @@ QObject *QQuickDropAreaDrag::source() const
}
/*!
\qmlpropertygroup QtQuick::DropArea::drag
\qmlproperty qreal QtQuick::DropArea::drag.x
\qmlproperty qreal QtQuick::DropArea::drag.y

View File

@ -646,6 +646,7 @@ is finished.
*/
/*!
\qmlpropertygroup QtQuick::Flickable::visibleArea
\qmlproperty real QtQuick::Flickable::visibleArea.xPosition
\qmlproperty real QtQuick::Flickable::visibleArea.widthRatio
\qmlproperty real QtQuick::Flickable::visibleArea.yPosition

View File

@ -3052,6 +3052,7 @@ void QQuickItemPrivate::_q_resourceObjectDeleted(QObject *object)
}
/*!
\qmlpropertygroup QtQuick::Item::anchors
\qmlproperty AnchorLine QtQuick::Item::anchors.top
\qmlproperty AnchorLine QtQuick::Item::anchors.bottom
\qmlproperty AnchorLine QtQuick::Item::anchors.left
@ -3175,6 +3176,7 @@ QQmlListProperty<QObject> QQuickItemPrivate::data()
}
/*!
\qmlpropertygroup QtQuick::Item::childrenRect
\qmlproperty real QtQuick::Item::childrenRect.x
\qmlproperty real QtQuick::Item::childrenRect.y
\qmlproperty real QtQuick::Item::childrenRect.width

View File

@ -486,6 +486,7 @@ void QQuickAnchorAnimation::setDuration(int duration)
}
/*!
\qmlpropertygroup QtQuick::AnchorAnimation::easing
\qmlproperty enumeration QtQuick::AnchorAnimation::easing.type
\qmlproperty real QtQuick::AnchorAnimation::easing.amplitude
\qmlproperty real QtQuick::AnchorAnimation::easing.overshoot
@ -622,6 +623,7 @@ void QQuickPathAnimation::setDuration(int duration)
}
/*!
\qmlpropertygroup QtQuick::PathAnimation::easing
\qmlproperty enumeration QtQuick::PathAnimation::easing.type
\qmlproperty real QtQuick::PathAnimation::easing.amplitude
\qmlproperty list<real> QtQuick::PathAnimation::easing.bezierCurve

View File

@ -2101,7 +2101,7 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QQmlChangeSet::Re
{
if (removeResult->visiblePos.isValid()) {
if (item->position() < removeResult->visiblePos)
removeResult->sizeChangesBeforeVisiblePos += item->size();
updateSizeChangesBeforeVisiblePos(item, removeResult);
else
removeResult->sizeChangesAfterVisiblePos += item->size();
}
@ -2116,6 +2116,11 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QQmlChangeSet::Re
removeResult->changedFirstItem = true;
}
void QQuickItemViewPrivate::updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult)
{
removeResult->sizeChangesBeforeVisiblePos += item->size();
}
void QQuickItemViewPrivate::repositionFirstItem(FxViewItem *prevVisibleItemsFirst,
qreal prevVisibleItemsFirstPos,
FxViewItem *prevFirstVisible,

View File

@ -211,6 +211,7 @@ public:
bool applyModelChanges(ChangeResult *insertionResult, ChangeResult *removalResult);
bool applyRemovalChange(const QQmlChangeSet::Remove &removal, ChangeResult *changeResult, int *removedCount);
void removeItem(FxViewItem *item, const QQmlChangeSet::Remove &removal, ChangeResult *removeResult);
virtual void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult);
void repositionFirstItem(FxViewItem *prevVisibleItemsFirst, qreal prevVisibleItemsFirstPos,
FxViewItem *prevFirstVisible, ChangeResult *insertionResult, ChangeResult *removalResult);

View File

@ -98,6 +98,7 @@ public:
virtual void repositionPackageItemAt(QQuickItem *item, int index);
virtual void resetFirstItemPosition(qreal pos = 0.0);
virtual void adjustFirstItem(qreal forwards, qreal backwards, int);
virtual void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult);
virtual void createHighlight();
virtual void updateHighlight();
@ -846,6 +847,12 @@ void QQuickListViewPrivate::adjustFirstItem(qreal forwards, qreal backwards, int
static_cast<FxListItemSG*>(visibleItems.first())->setPosition(visibleItems.first()->position() + diff);
}
void QQuickListViewPrivate::updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult)
{
if (item != visibleItems.first())
QQuickItemViewPrivate::updateSizeChangesBeforeVisiblePos(item, removeResult);
}
void QQuickListViewPrivate::createHighlight()
{
Q_Q(QQuickListView);
@ -2167,6 +2174,7 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
*/
/*!
\qmlpropertygroup QtQuick::ListView::section
\qmlproperty string QtQuick::ListView::section.property
\qmlproperty enumeration QtQuick::ListView::section.criteria
\qmlproperty Component QtQuick::ListView::section.delegate

View File

@ -1183,6 +1183,7 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape)
#endif
/*!
\qmlpropertygroup QtQuick::MouseArea::drag
\qmlproperty Item QtQuick::MouseArea::drag.target
\qmlproperty bool QtQuick::MouseArea::drag.active
\qmlproperty enumeration QtQuick::MouseArea::drag.axis

View File

@ -221,6 +221,7 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
/*!
\qmlpropertygroup QtQuick::PinchArea::pinch
\qmlproperty Item QtQuick::PinchArea::pinch.target
\qmlproperty bool QtQuick::PinchArea::pinch.active
\qmlproperty real QtQuick::PinchArea::pinch.minimumScale

View File

@ -331,6 +331,7 @@ void QQuickRectangle::doUpdate()
*/
/*!
\qmlpropertygroup QtQuick::Rectangle::border
\qmlproperty int QtQuick::Rectangle::border.width
\qmlproperty color QtQuick::Rectangle::border.color

View File

@ -954,6 +954,7 @@ void QQuickAnchorChanges::setObject(QQuickItem *target)
}
/*!
\qmlpropertygroup QtQuick::AnchorChanges::anchors
\qmlproperty AnchorLine QtQuick::AnchorChanges::anchors.left
\qmlproperty AnchorLine QtQuick::AnchorChanges::anchors.right
\qmlproperty AnchorLine QtQuick::AnchorChanges::anchors.horizontalCenter

View File

@ -198,6 +198,7 @@ QQuickScale::~QQuickScale()
}
/*!
\qmlpropertygroup QtQuick::Scale::origin
\qmlproperty real QtQuick::Scale::origin.x
\qmlproperty real QtQuick::Scale::origin.y
@ -347,6 +348,7 @@ QQuickRotation::~QQuickRotation()
}
/*!
\qmlpropertygroup QtQuick::Rotation::origin
\qmlproperty real QtQuick::Rotation::origin.x
\qmlproperty real QtQuick::Rotation::origin.y
@ -391,6 +393,7 @@ void QQuickRotation::setAngle(qreal angle)
}
/*!
\qmlpropertygroup QtQuick::Rotation::axis
\qmlproperty real QtQuick::Rotation::axis.x
\qmlproperty real QtQuick::Rotation::axis.y
\qmlproperty real QtQuick::Rotation::axis.z

View File

@ -9,7 +9,7 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
exists("qqml_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
LIBS += -lgcov
LIBS_PRIVATE += -lgcov
}
QMAKE_DOCS = $$PWD/doc/qtquick.qdocconf
@ -40,17 +40,3 @@ SOURCES += qtquick2.cpp
# To make #include "qquickcontext2d_jsclass.cpp" work
INCLUDEPATH += $$PWD
mac {
# FIXME: this is a workaround for broken qmake logic in qtAddModule()
# This function refuses to use frameworks unless the framework exists on
# the filesystem at the time qmake is run, resulting in a build failure
# if QtQuick is qmaked before QtQml is built and frameworks are
# in use. qtAddLibrary() contains correct logic to deal with this, so
# we'll explicitly call that for now.
load(qt)
LIBS -= -lQtQml # in non-framework builds, these should be re-added
LIBS -= -lQtQml_debug # within the qtAddLibrary if appropriate, so no
qtAddLibrary(QtQml) # harm done :)
}

View File

@ -2083,6 +2083,7 @@ void QQuickPropertyAnimation::setTo(const QVariant &t)
}
/*!
\qmlpropertygroup QtQuick::PropertyAnimation::easing
\qmlproperty enumeration QtQuick::PropertyAnimation::easing.type
\qmlproperty real QtQuick::PropertyAnimation::easing.amplitude
\qmlproperty real QtQuick::PropertyAnimation::easing.overshoot

View File

@ -62,7 +62,7 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate

View File

@ -69,7 +69,7 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate

View File

@ -26,7 +26,6 @@ Rectangle {
focus: true
width: initialViewWidth
height: initialViewHeight
cacheBuffer: 0
snapMode: ListView.SnapToItem
model: testModel
delegate: myDelegate

View File

@ -45,7 +45,7 @@ Rectangle {
objectName: "list"
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate
highlight: myHighlight

View File

@ -43,7 +43,7 @@ Rectangle {
currentIndex: -1
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
delegate: myDelegate
highlightMoveVelocity: 1000
model: testModel

View File

@ -68,6 +68,6 @@ Rectangle {
height: 320
model: visualModel.parts.package
section.property: "number"
cacheBuffer: 0
cacheBuffer: 60
}
}

View File

@ -56,7 +56,7 @@ Rectangle {
objectName: "list"
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate
section.property: sectionProperty

View File

@ -42,7 +42,7 @@ Rectangle {
topMargin: 30
bottomMargin: 50
highlightMoveVelocity: 100000
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate
}

View File

@ -62,7 +62,7 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate

View File

@ -44,7 +44,7 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate

View File

@ -53,7 +53,6 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
model: testModel
delegate: myDelegate

View File

@ -52,7 +52,7 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate

View File

@ -64,7 +64,7 @@ Rectangle {
anchors.centerIn: parent
width: 240
height: 320
cacheBuffer: 0
cacheBuffer: 60
model: testModel
delegate: myDelegate

View File

@ -737,6 +737,8 @@ void tst_QQuickListView::insertBeforeVisible()
{
QFETCH(int, insertIndex);
QFETCH(int, insertCount);
QFETCH(int, removeIndex);
QFETCH(int, removeCount);
QFETCH(int, cacheBuffer);
QQuickText *name;
@ -776,14 +778,19 @@ void tst_QQuickListView::insertBeforeVisible()
QVERIFY(item);
QCOMPARE(item->y(), listview->contentY());
QList<QPair<QString, QString> > newData;
for (int i=0; i<insertCount; i++)
newData << qMakePair(QString("value %1").arg(i), QString::number(i));
model.insertItems(insertIndex, newData);
QTRY_COMPARE(listview->property("count").toInt(), model.count());
if (removeCount > 0)
model.removeItems(removeIndex, removeCount);
if (insertCount > 0) {
QList<QPair<QString, QString> > newData;
for (int i=0; i<insertCount; i++)
newData << qMakePair(QString("value %1").arg(i), QString::number(i));
model.insertItems(insertIndex, newData);
QTRY_COMPARE(listview->property("count").toInt(), model.count());
}
// now, moving to the top of the view should position the inserted items correctly
int itemsOffsetAfterMove = -(insertCount * 20);
int itemsOffsetAfterMove = (removeCount - insertCount) * 20;
listview->setCurrentIndex(0);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
QTRY_COMPARE(listview->currentIndex(), 0);
@ -808,23 +815,41 @@ void tst_QQuickListView::insertBeforeVisible_data()
{
QTest::addColumn<int>("insertIndex");
QTest::addColumn<int>("insertCount");
QTest::addColumn<int>("removeIndex");
QTest::addColumn<int>("removeCount");
QTest::addColumn<int>("cacheBuffer");
QTest::newRow("insert 1 at 0, 0 buffer") << 0 << 1 << 0;
QTest::newRow("insert 1 at 0, 100 buffer") << 0 << 1 << 100;
QTest::newRow("insert 1 at 0, 500 buffer") << 0 << 1 << 500;
QTest::newRow("insert 1 at 0, 0 buffer") << 0 << 1 << 0 << 0 << 0;
QTest::newRow("insert 1 at 0, 100 buffer") << 0 << 1 << 0 << 0 << 100;
QTest::newRow("insert 1 at 0, 500 buffer") << 0 << 1 << 0 << 0 << 500;
QTest::newRow("insert 1 at 1, 0 buffer") << 1 << 1 << 0;
QTest::newRow("insert 1 at 1, 100 buffer") << 1 << 1 << 100;
QTest::newRow("insert 1 at 1, 500 buffer") << 1 << 1 << 500;
QTest::newRow("insert 1 at 1, 0 buffer") << 1 << 1 << 0 << 0 << 0;
QTest::newRow("insert 1 at 1, 100 buffer") << 1 << 1 << 0 << 0 << 100;
QTest::newRow("insert 1 at 1, 500 buffer") << 1 << 1 << 0 << 0 << 500;
QTest::newRow("insert multiple at 0, 0 buffer") << 0 << 3 << 0;
QTest::newRow("insert multiple at 0, 100 buffer") << 0 << 3 << 100;
QTest::newRow("insert multiple at 0, 500 buffer") << 0 << 3 << 500;
QTest::newRow("insert multiple at 0, 0 buffer") << 0 << 3 << 0 << 0 << 0;
QTest::newRow("insert multiple at 0, 100 buffer") << 0 << 3 << 0 << 0 << 100;
QTest::newRow("insert multiple at 0, 500 buffer") << 0 << 3 << 0 << 0 << 500;
QTest::newRow("insert multiple at 1, 0 buffer") << 1 << 3 << 0;
QTest::newRow("insert multiple at 1, 100 buffer") << 1 << 3 << 100;
QTest::newRow("insert multiple at 1, 500 buffer") << 1 << 3 << 500;
QTest::newRow("insert multiple at 1, 0 buffer") << 1 << 3 << 0 << 0 << 0;
QTest::newRow("insert multiple at 1, 100 buffer") << 1 << 3 << 0 << 0 << 100;
QTest::newRow("insert multiple at 1, 500 buffer") << 1 << 3 << 0 << 0 << 500;
QTest::newRow("remove 1 at 0, 0 buffer") << 0 << 0 << 0 << 1 << 0;
QTest::newRow("remove 1 at 0, 100 buffer") << 0 << 0 << 0 << 1 << 100;
QTest::newRow("remove 1 at 0, 500 buffer") << 0 << 0 << 0 << 1 << 500;
QTest::newRow("remove 1 at 1, 0 buffer") << 0 << 0 << 1 << 1 << 0;
QTest::newRow("remove 1 at 1, 100 buffer") << 0 << 0 << 1 << 1 << 100;
QTest::newRow("remove 1 at 1, 500 buffer") << 0 << 0 << 1 << 1 << 500;
QTest::newRow("remove multiple at 0, 0 buffer") << 0 << 0 << 0 << 3 << 0;
QTest::newRow("remove multiple at 0, 100 buffer") << 0 << 0 << 0 << 3 << 100;
QTest::newRow("remove multiple at 0, 500 buffer") << 0 << 0 << 0 << 3 << 500;
QTest::newRow("remove multiple at 1, 0 buffer") << 0 << 0 << 1 << 3 << 0;
QTest::newRow("remove multiple at 1, 100 buffer") << 0 << 0 << 1 << 3 << 100;
QTest::newRow("remove multiple at 1, 500 buffer") << 0 << 0 << 1 << 3 << 500;
}
template <class T>