summaryrefslogtreecommitdiff
path: root/src/mobile/qml/ContextMenu.qml
blob: bf55ebfa0af733a439630b6143a75937ccb364b6 (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
import QtQuick 2.1
import BibleTime 1.0

Rectangle {
    id: contextMenu

    property alias model: menuList.model

    signal accepted(string action)

    color: "white"
    border.color: "black"
    border.width: 1
    anchors.centerIn: parent
    height: 250
    width: 250

    onVisibleChanged: PropertyAnimation {
        target: settings
        property: "opacity"
        from: 0
        to: 1
        duration: 400
        easing.type: Easing.InOutCubic
    }

    BtStyle {
        id: btStyle
    }

    ListView {
        id: menuList

        anchors.fill: parent
        anchors.topMargin: 100

        delegate: Rectangle {
            color: "white"
            border.color: "black"
            border.width: 1
            width: parent.width
            height: children[0].height * 2.5

            Text {
                id: menuText
                x: 40
                anchors.verticalCenter: parent.verticalCenter
                text: title
                color: "black"
                font.pointSize: btStyle.uiFontPointSize
            }

            MouseArea {
                anchors.fill: parent
                onClicked: {
                    contextMenu.visible = false;
                    contextMenu.accepted(action);
                }
            }
        }
    }
}