area may be created/retained. The buffered delegates are created asynchronously,
allowing creation to occur across multiple frames and reducing the
likelihood of skipping frames. In order to improve painting performance
- delegates outside the visible area have their \l visible property set to
- false until they are moved into the visible area.
+ delegates outside the visible area are not painted.
+
+ The default value of this property is platform dependent, but will usually
+ be a non-zero value.
Note that cacheBuffer is not a pixel buffer - it only maintains additional
instantiated delegates.
#include "qquickitemview_p_p.h"
#include <QtQuick/private/qquicktransition_p.h>
+#include "qplatformdefs.h"
QT_BEGIN_NAMESPACE
+// Default cacheBuffer for all views.
+#ifndef QML_VIEW_DEFAULTCACHEBUFFER
+#define QML_VIEW_DEFAULTCACHEBUFFER 320
+#endif
FxViewItem::FxViewItem(QQuickItem *i, bool own, bool trackGeometry)
: item(i)
QQuickItemViewPrivate::QQuickItemViewPrivate()
: itemCount(0)
- , buffer(0), bufferMode(BufferBefore | BufferAfter)
+ , buffer(QML_VIEW_DEFAULTCACHEBUFFER), bufferMode(BufferBefore | BufferAfter)
, layoutDirection(Qt::LeftToRight), verticalLayoutDirection(QQuickItemView::TopToBottom)
, moveReason(Other)
, visibleIndex(0)
area may be created/retained. The buffered delegates are created asynchronously,
allowing creation to occur across multiple frames and reducing the
likelihood of skipping frames. In order to improve painting performance
- delegates outside the visible area have their \l visible property set to
- false until they are moved into the visible area.
+ delegates outside the visible area are not painted.
+
+ The default value of this property is platform dependent, but will usually
+ be a non-zero value.
Note that cacheBuffer is not a pixel buffer - it only maintains additional
instantiated delegates.
height: 320
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
anchors.centerIn: parent
model: testModel
delegate: myDelegate
height: 320
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
currentIndex: 35
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
delegate: myDelegate
highlightMoveDuration: 400
model: testModel
currentIndex: -1
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
delegate: myDelegate
model: testModel
}
height: 320
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom
layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
verticalLayoutDirection: (testBottomToTop == true) ? GridView.BottomToTop : GridView.TopToBottom
height: 320
cellWidth: 100
cellHeight: 80
+ cacheBuffer: 0
leftMargin: 30
rightMargin: 50
flow: GridView.TopToBottom
height: 320
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
anchors.centerIn: parent
model: testModel
delegate: myDelegate
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
cellWidth: 80
cellHeight: 60
model: testModel
cellWidth: 80
cellHeight: 60
anchors.centerIn: parent
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
height: 320
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
height: 320
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
anchors.centerIn: parent
model: testModel
delegate: myDelegate
height: initialHeight
cellWidth: 80
cellHeight: 60
+ cacheBuffer: 0
model: testModel
delegate: Rectangle {
objectName: "wrapper"
model: visualModel.parts.left
cellWidth: 60
cellHeight: 80
+ cacheBuffer: 0
}
GridView {
model: visualModel.parts.right
cellWidth: 60
cellHeight: 80
+ cacheBuffer: 0
}
}
#include "../shared/viewtestutil.h"
#include "../shared/visualtestutil.h"
#include <QtGui/qguiapplication.h>
+#include "qplatformdefs.h"
Q_DECLARE_METATYPE(QQuickGridView::Flow)
Q_DECLARE_METATYPE(Qt::LayoutDirection)
QTRY_COMPARE(obj->highlightFollowsCurrentItem(), true);
QTRY_VERIFY(obj->flow() == 0);
QTRY_COMPARE(obj->isWrapEnabled(), false);
- QTRY_COMPARE(obj->cacheBuffer(), 0);
+#ifdef QML_VIEW_DEFAULTCACHEBUFFER
+ QTRY_COMPARE(obj->cacheBuffer(), QML_VIEW_DEFAULTCACHEBUFFER);
+#else
+ QTRY_COMPARE(obj->cacheBuffer(), 320);
+#endif
QTRY_COMPARE(obj->cellWidth(), qreal(100)); //### Should 100 be the default?
QTRY_COMPARE(obj->cellHeight(), qreal(100));
delete obj;
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
focus: true
width: initialViewWidth
height: initialViewHeight
+ cacheBuffer: 0
snapMode: ListView.SnapToItem
model: testModel
delegate: myDelegate
objectName: "list"
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
highlight: myHighlight
currentIndex: -1
width: 240
height: 320
+ cacheBuffer: 0
delegate: myDelegate
highlightMoveSpeed: 1000
model: testModel
height: 320
model: visualModel.parts.package
section.property: "number"
+ cacheBuffer: 0
}
}
objectName: "list"
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
section.property: sectionProperty
anchors.fill: parent
topMargin: 30
bottomMargin: 50
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
}
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
anchors.centerIn: parent
width: 240
height: 320
+ cacheBuffer: 0
model: testModel
delegate: myDelegate
id: list
objectName: "list"
width: 240
+ cacheBuffer: 0
height: initialHeight
model: testModel
delegate: Rectangle {
ListView {
id: leftList
objectName: "leftList"
+ cacheBuffer: 0
anchors {
left: parent.left; top: parent.top;
right: parent.horizontalCenter; bottom: parent.bottom
ListView {
id: rightList
objectName: "rightList"
+ cacheBuffer: 0
anchors {
left: parent.horizontalCenter; top: parent.top;
right: parent.right; bottom: parent.bottom
ListView {
id: leftList
objectName: "leftList"
+ cacheBuffer: 0
anchors {
left: parent.left; top: parent.top;
right: parent.horizontalCenter; bottom: parent.bottom
ListView {
id: rightList
objectName: "rightList"
+ cacheBuffer: 0
anchors {
left: parent.horizontalCenter; top: parent.top;
right: parent.right; bottom: parent.bottom