File: Button.qml

package info (click to toggle)
qt6-positioning 6.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,064 kB
  • sloc: cpp: 35,740; java: 513; xml: 58; makefile: 23
file content (30 lines) | stat: -rw-r--r-- 929 bytes parent folder | download | duplicates (2)
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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Controls.Basic

ItemDelegate {
    id: root

    property bool redHover: false
    readonly property color pressedColor: root.redHover ? Theme.buttonRedTextPressedColor
                                                        : Theme.buttonTextPressedColor

    contentItem: Text {
        text: root.text
        font.pixelSize: Theme.mediumFontSize
        font.weight: Theme.fontDefaultWeight
        color: root.pressed ? root.pressedColor : Theme.buttonTextColor
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
    }
    background: Rectangle {
        border {
            width: 2
            color: root.pressed ? root.pressedColor : Theme.buttonTextColor
        }
        radius: 10
        color: Theme.buttonBackgroundColor
    }
}