gpt4all/gpt4all-chat/qml/MyToolButton.qml

48 lines
1.2 KiB
QML
Raw Normal View History

import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import Qt5Compat.GraphicalEffects
Button {
id: myButton
padding: 10
property bool toggled: false
property alias source: image.source
2023-07-06 10:53:43 -04:00
property alias fillMode: image.fillMode
contentItem: Text {
text: myButton.text
horizontalAlignment: Text.AlignHCenter
color: myButton.enabled ? theme.textColor : theme.mutedTextColor
2023-08-07 13:54:13 -04:00
font.pixelSize: theme.fontSizeLarge
Accessible.role: Accessible.Button
Accessible.name: text
}
background: Item {
anchors.fill: parent
Rectangle {
anchors.fill: parent
color: "transparent"
visible: myButton.toggled
border.color: theme.backgroundLightest
border.width: 1
radius: 10
}
Image {
id: image
anchors.centerIn: parent
mipmap: true
width: 30
height: 30
}
ColorOverlay {
anchors.fill: image
source: image
color: myButton.hovered ? theme.textColor : "transparent"
}
}
Accessible.role: Accessible.Button
Accessible.name: text
2023-08-07 13:54:13 -04:00
}