zoukankan      html  css  js  c++  java
  • QML 怎么在gridview中用Index定位? 怎么在代理中设置背景?

    import QtQuick 1.0

    Item {
    id: me
    100
    height: 300

    GridView {
    id: grid
    anchors.fill: parent

    model: 60
    cellHeight: 20
    cellWidth: 20

    property int colcount: Math.floor(width / cellWidth)

    delegate: Rectangle {
    grid.cellWidth
    height: grid.cellHeight
    color: {
    var rowIndex = Math.floor(index / grid.colcount);
    switch (rowIndex % 3) {
    case 0:
    return "yellow";
    case 1:
    return "blue";
    case 2:
    return "grey";
    }
    }

    Text {
    anchors.centerIn: parent
    font.pixelSize: 15
    text: index
    }
    }
    }
    }
  • 相关阅读:
    Spring----Day03
    Spring----Day02
    python
    python
    python
    python
    python
    python
    python
    python
  • 原文地址:https://www.cnblogs.com/gibbon/p/Gibbon.html
Copyright © 2011-2022 走看看