Performance: QML window repaints himself very slow

本小妞迷上赌 提交于 2019-12-21 02:37:07

问题


I've created this QML window but when I grab it's border with a mouse and resize it contents of window are repainted very slow. You can clone my repo and test it yourself. Any ideas how to improve performance?

import QtQuick 2.0
Rectangle {

 id: root
  width: 600
  height: 600
  color: "lightgrey"
  ListView {
    model: mainModel
    spacing: 5

    width: parent.width
    orientation: ListView.Horizontal

    delegate: Rectangle {
        //width: parent.desiredWidth / mainModel.dataLen()//+ " " + model.sort
        width: root.width / mainModel.dataLen() - 10
        //width: 200

        ListView {
            id: lv1
            ScrollBar {
                flickable: lv1
                vertical: true
                hideScrollBarsWhenStopped: false
                scrollbarWidth: 5
            }

            model: homm
            spacing: 5
            width: parent.width
            height: 150
            orientation: ListView.Vertical
            delegate:
                Rectangle {
                    radius: 5
                    anchors.rightMargin: 5
                    anchors.leftMargin: 5
                    width: lv1.width
                    height: 20
                    color: "black"
                    Text { text: model.name 
                        anchors.fill: parent
                        color: "white"
                    }
            }
        }
    }

}
}

In this QML I have listView of listViews which visualize ListModel of ListModels. homm is a property name for main model. Inner models' elements have a property named name. You can browser code of these classes here and here.

来源:https://stackoverflow.com/questions/14236386/performance-qml-window-repaints-himself-very-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!