summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml
blob: 77f7093fb096044d9cf18f40e03022cd5f96329e (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
<FocusRealm id="groupBox" width="{Math.max(270, subItem.width+40)}" height="{Math.max(70, subItem.height+40)}">
    <properties>
        <Property name="contents"/>
        <Property name="label"/>
    </properties>
    <Rect id="wrapper" x="5" y="10" radius="10"
        width="{groupBox.width-20}" height="{groupBox.height-20}"
        color="white" pen.color="black">
        <Item id="subItem" qml="{groupBox.contents}"
            anchors.top="{parent.top}" anchors.topMargin="10"
            anchors.right="{parent.right}" anchors.rightMargin="10"
            width="{qmlItem.width}" height="{qmlItem.height}"/>
    </Rect>
    <Rect x="20" y="0" height="{text.height}" width="{text.width+10}" color="white">
        <Text x="5" id="text" text="{label}" font.bold="true"/>
    </Rect>
    <Rect color="black" anchors.fill="{parent}" opacity="{parent.focus ? 0 : 0.3}">
        <MouseRegion anchors.fill="{parent}" onClicked="parent.parent.focus=true"/>
        <opacity>
            <Behaviour>
                <NumericAnimation property="opacity" duration="250"/>
            </Behaviour>
        </opacity>
    </Rect>
</FocusRealm>