gpt4all/gpt4all-chat/qml/MyWelcomeButton.qml
AT 9273b49b62
chat: major UI redesign for v3.0.0 (#2396)
Signed-off-by: Adam Treat <treat.adam@gmail.com>
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
Co-authored-by: Jared Van Bortel <jared@nomic.ai>
2024-06-24 18:49:23 -04:00

78 lines
2.4 KiB
QML

import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import Qt5Compat.GraphicalEffects
import QtQuick.Layouts
import mysettings
Button {
id: myButton
property alias imageSource: myimage.source
property alias description: description.text
contentItem: Item {
id: item
anchors.centerIn: parent
RowLayout {
anchors.fill: parent
Rectangle {
id: rec
color: "transparent"
Layout.preferredWidth: item.width * 1/5.5
Layout.preferredHeight: item.width * 1/5.5
Layout.alignment: Qt.AlignCenter
Image {
id: myimage
anchors.centerIn: parent
sourceSize.width: rec.width
sourceSize.height: rec.height
mipmap: true
visible: false
}
ColorOverlay {
anchors.fill: myimage
source: myimage
color: theme.welcomeButtonBorder
}
}
ColumnLayout {
Layout.preferredWidth: childrenRect.width
Text {
text: myButton.text
horizontalAlignment: Text.AlignHCenter
color: myButton.hovered ? theme.welcomeButtonTextHovered : theme.welcomeButtonText
font.pixelSize: theme.fontSizeBannerSmall
font.bold: true
Accessible.role: Accessible.Button
Accessible.name: text
}
Text {
id: description
horizontalAlignment: Text.AlignHCenter
color: myButton.hovered ? theme.welcomeButtonTextHovered : theme.welcomeButtonText
font.pixelSize: theme.fontSizeSmall
font.bold: false
Accessible.role: Accessible.Button
Accessible.name: text
}
}
}
}
background: Rectangle {
radius: 10
border.width: 1
border.color: myButton.hovered ? theme.welcomeButtonBorderHovered : theme.welcomeButtonBorder
color: theme.welcomeButtonBackground
}
Accessible.role: Accessible.Button
Accessible.name: text
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
}