美文网首页
后天八卦图 QML

后天八卦图 QML

作者: 风雷城主 | 来源:发表于2018-07-23 13:38 被阅读0次
    后天八卦图

    import QtQuick 2.10

    import QtQuick.Window 2.10

    Window {

        visible: true

        width: 480

        height: 640

        title: qsTr("后天八卦图")

        Text {

            anchors.topMargin: 10

            anchors.top: parent.top

            anchors.horizontalCenter: parent.horizontalCenter

            text: "后天八卦图"

            font.pointSize: 36

        }

        PathView {

            width: 360

            height: 360

            anchors.centerIn: parent

            model: ListModel {

                ListElement { value: "001"; caption: "震 三"}

                ListElement { value: "110"; caption: "巽 四"}

                ListElement { value: "101"; caption: "离 九"}

                ListElement { value: "000"; caption: "坤 二"}

                ListElement { value: "011"; caption: "兑 七"}

                ListElement { value: "111"; caption: "乾 六"}

                ListElement { value: "010"; caption: "坎 一"}

                ListElement { value: "100"; caption: "艮 八"}

            }

            delegate: Rectangle {

                width: 60

                height: 90

                Column {

                    width: parent.width

                    height: parent.height - 30

                    spacing: 5

                    Repeater {

                        model: 3

                        Rectangle {

                            width: parent.width

                            height: (parent.height - 10) / 3

                            color: value.slice(index,index + 1)==="1"?"red":"black"

                            Rectangle {

                                width: parent.width / 5

                                height: parent.height

                                anchors.centerIn: parent

                                visible: value.slice(index,index + 1)==="0"

                            }

                        }

                    }

                }

                Text {

                    font.bold: true

                    font.pointSize: 16

                    anchors.bottom: parent.bottom

                    anchors.horizontalCenter: parent.horizontalCenter

                    color: "black"

                    text: caption

                }

            }

            path: Path {

                startX: 0

                startY: 180

                PathArc {

                    x: 360

                    y: 180

                    radiusX: 180

                    radiusY: 180

                }

                PathArc {

                    x: 0

                    y: 180

                    radiusX: 180

                    radiusY: 180

                }

            }

        }

    }

    相关文章

      网友评论

          本文标题:后天八卦图 QML

          本文链接:https://www.haomeiwen.com/subject/avtjmftx.html