summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
+ }
}
}