aboutsummaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/Scanner/Menu.qml
blob: ef69c895e9b4f3ce99afcf3b8f52e84aeb2e44a2 (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
// Copyright (C) 2013 BlackBerry Limited. All rights reserved.
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

Rectangle {
    id: menu

    property real menuWidth: 100
    property real menuHeight: 50
    property string menuText: "Search"
    signal buttonClick

    height: menuHeight
    width: menuWidth

    Rectangle {
        id: search
        width: parent.width
        height: parent.height
        anchors.centerIn: parent
        color: "#363636"
        border.width: 1
        border.color: "#E3E3E3"
        radius: 5
        Text {
            id: searchText
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            anchors.fill: parent
            text: menu.menuText
            elide: Text.ElideMiddle
            color: "#E3E3E3"
            wrapMode: Text.WordWrap
        }

        MouseArea {
            anchors.fill: parent
            onPressed: {
                search.width = search.width - 7
                search.height = search.height - 5
            }

            onReleased: {
                search.width = search.width + 7
                search.height = search.height + 5
            }

            onClicked: {
                menu.buttonClick()
            }
        }
    }
}