File: ColorButton.qml

package info (click to toggle)
dtkdeclarative 5.7.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 29,848 kB
  • sloc: cpp: 20,566; ansic: 66; makefile: 29; sh: 25
file content (38 lines) | stat: -rw-r--r-- 761 bytes parent folder | download
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
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick 2.0
import org.deepin.dtk 1.0

Button {
    id: root
    property color color

    checkable: true
    background: Item {
        implicitWidth: 22
        implicitHeight: 22

        Rectangle {
            anchors {
                fill: parent
                margins: 3
            }

            radius: width / 2
            color: root.color
        }

        Rectangle {
            visible: root.checked
            anchors.fill: parent
            color: "transparent"
            radius: width / 2
            border {
                width: 1.5
                color: root.color
            }
        }
    }
}