blob: ef23327e0e62d3bdfe0b7ddb3b2699c35ce84bd0 (
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
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls.Basic
AbstractButton {
// Height, width and any other size related properties containing odd looking float or other dividers
// that do not seem to have any logical origin are just arbitrary and based on original design
// and/or personal preference on what looks nice.
id: button
property string buttonText: ""
property bool showIcon: true
property string buttonColor: "grey"
property alias rectangle: rectangle
states: State {
name: "pressed"
when: button.pressed
PropertyChanges {
target: rectangle
scale: 0.9
}
}
transitions: Transition {
NumberAnimation {
properties: "scale"
duration: 10
easing.type: Easing.InOutQuad
}
}
contentItem: Rectangle {
id: rectangle
border.width: 1
border.color: Colors.border
radius: 10
anchors.fill: parent
Row {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Text {
text: buttonText
color: (buttonColor
== "green") ? Colors.dark.textColor : Colors.currentTheme.textColor
font.pixelSize: 18
font.weight: 700
rightPadding: 8
}
Image {
id: icon
visible: showIcon
source: (Colors.currentTheme == Colors.dark) ? "./images/icons/keyboard_backspace_white_right.svg" : "./images/icons/keyboard_backspace_black_right.svg"
}
}
}
}
|