Make all the toolbuttons highlight on hover.

This commit is contained in:
Adam Treat
2023-05-31 21:07:14 -04:00
parent 93a05c8834
commit cae757aacd
4 changed files with 72 additions and 118 deletions

View File

@@ -141,41 +141,31 @@ Drawer {
anchors.right: chatRectangle.right
anchors.rightMargin: 10
spacing: 10
Button {
MyToolButton {
id: editButton
width: 30
height: 30
visible: isCurrent && !isServer
opacity: trashQuestionDisplayed ? 0.5 : 1.0
background: Image {
width: 30
height: 30
source: "qrc:/gpt4all/icons/edit.svg"
}
source: "qrc:/gpt4all/icons/edit.svg"
onClicked: {
chatName.focus = true
chatName.readOnly = false
chatName.selectByMouse = true
}
Accessible.role: Accessible.Button
Accessible.name: qsTr("Edit the chat name")
Accessible.description: qsTr("Provides a button to edit the chat name")
}
Button {
MyToolButton {
id: trashButton
width: 30
height: 30
visible: isCurrent && !isServer
background: Image {
width: 30
height: 30
source: "qrc:/gpt4all/icons/trash.svg"
}
source: "qrc:/gpt4all/icons/trash.svg"
onClicked: {
trashQuestionDisplayed = true
timer.start()
}
Accessible.role: Accessible.Button
Accessible.name: qsTr("Delete of the chat")
Accessible.description: qsTr("Provides a button to delete the chat")
}

View File

@@ -0,0 +1,44 @@
import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import Qt5Compat.GraphicalEffects
Button {
id: myButton
padding: 10
property alias source: image.source
contentItem: Text {
text: myButton.text
horizontalAlignment: Text.AlignHCenter
color: myButton.enabled ? theme.textColor : theme.mutedTextColor
Accessible.role: Accessible.Button
Accessible.name: text
}
background: Item {
anchors.fill: parent
Rectangle {
anchors.fill: parent
color: "transparent"
visible: myButton.checkable && myButton.checked
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
}