aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml
blob: 2f7b120b7fe038181babd8d10ab7a318d69ab0d5 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

Rectangle {
    id: page
    color: "white"
    width: 182; height: 182
    border.color: "gray"

//! [tiled border image]
BorderImage {
    anchors { fill: parent; margins: 1 }
    border { left: 30; top: 30; right: 30; bottom: 30 }
    horizontalTileMode: BorderImage.Repeat
    verticalTileMode: BorderImage.Repeat
    source: "pics/borderframe.png"
}
//! [tiled border image]

    Rectangle {
        x: 30; y: 0
        width: 1; height: parent.height
        color: "gray"

        Text {
            text: "1"
            font.pixelSize: 9
            color: "red"
            anchors.right: parent.right
            anchors.rightMargin: 1
            y: 20
        }

        Text {
            text: "4"
            font.pixelSize: 9
            color: "red"
            anchors.verticalCenter: parent.verticalCenter
            anchors.right: parent.right
            anchors.rightMargin: 1
        }

        Text {
            text: "7"
            font.pixelSize: 9
            color: "red"
            y: parent.height - 30
            anchors.right: parent.right
            anchors.rightMargin: 1
        }
    }

    Rectangle {
        x: parent.width - 30; y: 0
        width: 1; height: parent.height
        color: "gray"

        Text {
            text: "3"
            font.pixelSize: 9
            color: "red"
            x: 1
            y: 20
        }

        Text {
            text: "6"
            font.pixelSize: 9
            color: "red"
            x: 1
            anchors.verticalCenter: parent.verticalCenter
        }

        Text {
            text: "9"
            font.pixelSize: 9
            color: "red"
            x: 1
            y: parent.height - 30
        }
    }

    Text {
        text: "5"
        font.pixelSize: 9
        color: "red"
        anchors.centerIn: parent
    }

    Rectangle {
        x: 0; y: 30
        width: parent.width; height: 1
        color: "gray"

        Text {
            text: "2"
            font.pixelSize: 9
            color: "red"
            anchors.horizontalCenter: parent.horizontalCenter
            y: -10
        }
    }

    Rectangle {
        x: 0; y: parent.height - 30
        width: parent.width; height: 1
        color: "gray"

        Text {
            text: "8"
            font.pixelSize: 9
            color: "red"
            anchors.horizontalCenter: parent.horizontalCenter
        }
    }
}