Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
import QtQuick 2.6
import QtQuick.Controls 1.4

Rectangle
{
    id
: rect1
    width: 640
    height: 480

    ListModel{
        id:libraryModel
        ListElement{title: "aaa"
; author: "AAA"}
        ListElement
{title: "bbb"; author: "BBB"}
        ListElement
{title: "ccc"; author: "ccc"}
    }

    TableView
{
        anchors.fill
: parent
        model:libraryModel

        TableViewColumn{role:"title"
; title: "Title"; width: 100}
        TableViewColumn
{role:"author"; title: "Author"; width: 200}

        rowDelegate: Rectangle
{
            height
: 50
            color: styleData.selected?"#f0b0b0af":(styleData.alternate?"#c3c3c0":"#c0c0c3")
        
}

        itemDelegate: Rectangle 
{
            height
: 50
            color: "transparent"
            Text {
                //anchors.centerIn: parent
                anchors.left: parent.left
                anchors.leftMargin: 6
                anchors.verticalCenter: parent.verticalCenter
                color: styleData.textColor
                text: styleData.value
                verticalAlignment: Text.AlignVCenter
                font.pointSize: 13
            
}
         }
    }
}
posted on 2019-09-06 17:26 ccsdu2009 阅读(2903) 评论(0)  编辑 收藏 引用 所属分类: QT编程

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