Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
ListView
        {
            id: view
            orientation: Qt.Horizontal
            Layout.fillWidth: true
            height:64
            //model: 180
            spacing: -24
            clip: true

            delegate: Rectangle
            {
                width: 50
                height: parent.height

                Image
                {
                    id:imageItem
                    width:64
                    height:64
                    anchors.centerIn: parent
                    source:getFileName(index*Math.floor(2560/180))
                    property int current: 0

                    onSourceChanged:
                    {
                        current = index;
                    }

                    MouseArea
                    {
                        id: mouseArea
                        anchors.fill: parent
                        onClicked:
                        {
                            var filename = getFileName(Math.floor(2560/180)*imageItem.current)
                            image.source = filename
                        }
                    }
                }

                function getFileName(index)
                {
                    return "images/"+index+".png"
                }
            }
        }
posted on 2019-08-14 16:02 ccsdu2009 阅读(1370) 评论(0)  编辑 收藏 引用 所属分类: QT编程

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理