aboutsummaryrefslogtreecommitdiffstats
path: root/src/clapcontrols/ClapMenu.qml
blob: 7637ea074298286f4858a7933b5a765c32990fcd (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) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Qt-Commercial

import QtQuick
import QtQuick.Controls.Basic

import Clap.Controls

Menu {
    id: root

    property color cBg: QClapStyle.color("bg1")
    property color cText: QClapStyle.color("fg")
    property color cMenuHighlight: QClapStyle.color("blue")

    delegate: MenuItem {
        id: menuItem
        contentItem: Item {
            Text {
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 5

                text: menuItem.text
                color: root.cText
            }
            Rectangle {
                id: indicator

                anchors.verticalCenter: parent.verticalCenter
                anchors.right: parent.right
                width: 6
                height: parent.height

                visible: menuItem.highlighted
                color: root.cMenuHighlight
            }
        }
        background: Rectangle {
            implicitWidth: 210
            implicitHeight: 35
            color: "transparent"
        }
    }
    background: Rectangle {
        implicitWidth: 210
        implicitHeight: 35
        color: root.cBg
    }
}