gpt4all/gpt4all-chat/qml/MySettingsButton.qml
Jared Van Bortel 225bf6be93
Remove binary state from high-level API and use Jinja templates (#3147)
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
Signed-off-by: Adam Treat <treat.adam@gmail.com>
Co-authored-by: Adam Treat <treat.adam@gmail.com>
2024-11-25 10:04:17 -05:00

44 lines
1.4 KiB
QML

import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import mysettings
Button {
id: myButton
padding: 10
rightPadding: 18
leftPadding: 18
property color textColor: theme.lightButtonText
property color mutedTextColor: theme.lightButtonMutedText
property color backgroundColor: theme.lightButtonBackground
property color backgroundColorHovered: enabled ? theme.lightButtonBackgroundHovered : backgroundColor
property real borderWidth: 0
property color borderColor: "transparent"
property real fontPixelSize: theme.fontSizeLarge
property string toolTip
property alias backgroundRadius: background.radius
contentItem: Text {
text: myButton.text
horizontalAlignment: Text.AlignHCenter
color: myButton.enabled ? textColor : mutedTextColor
font.pixelSize: fontPixelSize
font.bold: true
Accessible.role: Accessible.Button
Accessible.name: text
}
background: Rectangle {
id: background
radius: 10
border.width: borderWidth
border.color: borderColor
color: myButton.hovered ? backgroundColorHovered : backgroundColor
}
Accessible.role: Accessible.Button
Accessible.name: text
ToolTip.text: toolTip
ToolTip.visible: toolTip !== "" && myButton.hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
}