summaryrefslogtreecommitdiffstats
path: root/util/qt3d/assetviewer/qml/Widgets/Checkered.qml
blob: 49bf1d8220337dfc6c50b60d7a8eecf3a0d9b59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import QtQuick 1.0

Grid {
    property variant color1: "#FFFFFF"
    property variant color2: "#BBBBBB"
    property variant cellSize: 10
    width: 20
    height: parent.height
    clip: true

    rows: height/cellSize
    columns: width/cellSize
    Repeater {
        model: parent.rows * parent.columns
        Rectangle {
            width: cellSize; height: cellSize;
            color: {
                var check;
                if (columns%2) check = index;
                else check = Math.floor(index/columns)%2 + index;

                if (check%2) return color1;
                else return color2;
            }
        }
    }
}