Qt 6.12 LTS is out! See what's new in the release
blog
Swipeview: how to render faster when many items in each pages
-
I tried to use Loader{} like help page
But it is still slow.
How to swipe rendering be faster?Test.qml
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Page { ListModel{ id:page_items ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} } footer:Button{text:"close" onClicked:{ stackView.pop(StackView.Immediate) } } TabBar { id: bar width: parent.width currentIndex:swipe.currentIndex TabButton { text: qsTr("A") } TabButton { text: qsTr("B") } TabButton { text: qsTr("C") } TabButton { text: qsTr("D") } TabButton { text: qsTr("E") } TabButton { text: qsTr("F") } TabButton { text: qsTr("G") } } SwipeView { id:swipe width: parent.width height:parent.height-bar.height-footer.height anchors.top: bar.bottom currentIndex: bar.currentIndex Repeater{ model:page_items Loader{ id:pageLoader active:SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem source:kandoitem asynchronous: false } } } }TestChild.qml
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Item { anchors.centerIn: parent width:parent.width height:parent.height-80 Flow{ anchors.fill: parent Repeater{ model:100 Button{text:index} } } } -
I tried to use Loader{} like help page
But it is still slow.
How to swipe rendering be faster?Test.qml
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Page { ListModel{ id:page_items ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} ListElement{kandoitem:"TestChild.qml"} } footer:Button{text:"close" onClicked:{ stackView.pop(StackView.Immediate) } } TabBar { id: bar width: parent.width currentIndex:swipe.currentIndex TabButton { text: qsTr("A") } TabButton { text: qsTr("B") } TabButton { text: qsTr("C") } TabButton { text: qsTr("D") } TabButton { text: qsTr("E") } TabButton { text: qsTr("F") } TabButton { text: qsTr("G") } } SwipeView { id:swipe width: parent.width height:parent.height-bar.height-footer.height anchors.top: bar.bottom currentIndex: bar.currentIndex Repeater{ model:page_items Loader{ id:pageLoader active:SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem source:kandoitem asynchronous: false } } } }TestChild.qml
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Item { anchors.centerIn: parent width:parent.width height:parent.height-80 Flow{ anchors.fill: parent Repeater{ model:100 Button{text:index} } } } -
I tried GridView, which is loaded array(QVector) of c++ model.
But it is still slow.GridView{ id:grid anchors.fill: parent model:30 cellWidth:parent.width/3 cellHeight:50 delegate:Component{ ValueBox{ name:index min:0;max:100; array_id:index;unit:"unit" array:cppModel.array; width: grid.cellWidth } } }ValueBox is original type, which has button, spinbox, label. Button open a panel.
-
@GrecKo said in Swipeview: how to render faster when many items in each pages:
@ynatynat Try a horizontal ListView with reuseItems enabled.
@ynatynat said

-
@GrecKo said in Swipeview: how to render faster when many items in each pages:
@ynatynat Try a horizontal ListView with reuseItems enabled.
@ynatynat said

-
Y ynatynat has marked this topic as solved on