Commit 1193cfa0 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig

Cache loaded items

This is a somewhat different solution for improving the
performance of the welcome screen. It has the added benefit
of caching loaded items while still retaining a decent
performance.

Change-Id: I9927a90f1b7de5bb06c43b16dc80cb2afec3f8ad
Reviewed-by: default avatarUlf Hermann <ulf.hermann@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 4b40cda3
......@@ -37,14 +37,12 @@ Rectangle {
CustomizedGridView {
id: grid
y: 82
height: grid.contentHeight
anchors.rightMargin: 38
anchors.leftMargin: 38
anchors.left: parent.left
anchors.right: parent.right
height: scrollView.height - 82
y: scrollView.flickableItem.contentY + 82
contentY: scrollView.flickableItem.contentY
model: examplesModel
}
......
......@@ -38,22 +38,30 @@ GridView {
cellWidth: 216
property int columns: Math.max(Math.floor(width / cellWidth), 1)
delegate: Delegate {
id: delegate
delegate: Loader {
property int delegateOffset: cellHeight * Math.floor(index / columns) + 100
property bool isVisible: delegateOffset > scrollView.flickableItem.contentY - cellHeight
&& delegateOffset < scrollView.flickableItem.contentY + scrollView.flickableItem.height
onIsVisibleChanged: active = true
visible: isVisible
active: false
sourceComponent: Delegate {
id: delegate
property bool isHelpImage: model.imageUrl.search(/qthelp/) != -1
property string sourcePrefix: isHelpImage ? "image://helpimage/" : ""
property bool isHelpImage: model.imageUrl.search(/qthelp/) != -1
property string sourcePrefix: isHelpImage ? "image://helpimage/" : ""
property string mockupSource: model.imageSource
property string helpSource: model.imageUrl !== "" ? sourcePrefix + encodeURI(model.imageUrl) : ""
property string mockupSource: model.imageSource
property string helpSource: model.imageUrl !== "" ? sourcePrefix + encodeURI(model.imageUrl) : ""
imageSource: isVideo ? "" : (model.imageSource === undefined ? helpSource : mockupSource)
videoSource: isVideo ? (model.imageSource === undefined ? model.imageUrl : mockupSource) : ""
imageSource: isVideo ? "" : (model.imageSource === undefined ? helpSource : mockupSource)
videoSource: isVideo ? (model.imageSource === undefined ? model.imageUrl : mockupSource) : ""
caption: model.name;
description: model.description
isVideo: model.isVideo === true
videoLength: model.videoLength !== undefined ? model.videoLength : ""
tags: model.tags
caption: model.name;
description: model.description
isVideo: model.isVideo === true
videoLength: model.videoLength !== undefined ? model.videoLength : ""
tags: model.tags
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment