summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-12-03 17:34:51 +0100
committerJens Bache-Wiig <jens.bache-wiig@digia.com>2013-12-17 16:23:35 +0100
commit1193cfa092ee7b3694d2aa5fede19fb86e224024 (patch)
tree0e057e7fc51f0d66b1c501fa02b61d0994c55927 /share
parent4b40cda342a1e5b6e729e6c00f0ba7d439851825 (diff)
downloadqt-creator-1193cfa092ee7b3694d2aa5fede19fb86e224024.tar.gz
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: Ulf Hermann <ulf.hermann@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/welcomescreen/examples.qml6
-rw-r--r--share/qtcreator/welcomescreen/widgets/CustomizedGridView.qml34
2 files changed, 23 insertions, 17 deletions
diff --git a/share/qtcreator/welcomescreen/examples.qml b/share/qtcreator/welcomescreen/examples.qml
index b485aed540..8ff9865c0f 100644
--- a/share/qtcreator/welcomescreen/examples.qml
+++ b/share/qtcreator/welcomescreen/examples.qml
@@ -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
}
diff --git a/share/qtcreator/welcomescreen/widgets/CustomizedGridView.qml b/share/qtcreator/welcomescreen/widgets/CustomizedGridView.qml
index bbe6b03109..59984d6d7f 100644
--- a/share/qtcreator/welcomescreen/widgets/CustomizedGridView.qml
+++ b/share/qtcreator/welcomescreen/widgets/CustomizedGridView.qml
@@ -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
+ }
}
}