aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/snippets/qml/reusablecomponents/Button.qml
blob: 5554befa3edd761b878ab7b619d7a30315281d61 (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [document]
//contents of Button.qml
import QtQuick

//! [parent begin]
Rectangle {
//! [parent begin]
    id: button
//! [properties]
    width: 145; height: 60
    color: "blue"
    antialiasing: true; radius: 9
    property alias text: label.text
//! [properties]
//! [object alias]
    property alias label: label
//! [object alias]
    border {color: "#B9C5D0"; width: 1}

    gradient: Gradient {
        GradientStop {color: "#CFF7FF"; position: 0.0}
        GradientStop {color: "#99C0E5"; position: 0.57}
        GradientStop {color: "#719FCB"; position: 0.9}
    }
//![text]
    Text {
        id: label
        anchors.centerIn: parent
        text: "Click Me!"
        font.pointSize: 12
        color: "blue"
    }
//![text]
    MouseArea {
        anchors.fill: parent
        onClicked: console.log(text + " clicked")
    }
//! [parent end]
}
//! [parent end]

//! [document]

//! [ellipses]
    //...
//! [ellipses]