Files
amnezia-client/client/ui/qml/Components/QuestionDrawer.qml
T

97 lines
2.3 KiB
QML
Raw Normal View History

2025-05-13 12:29:33 +08:00
pragma ComponentBehavior: Bound
2023-06-05 15:49:10 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
2024-07-07 13:42:38 +03:00
import Style 1.0
2023-06-05 15:49:10 +08:00
import "../Controls2"
import "../Controls2/TextTypes"
2024-04-18 17:54:55 +04:00
import "../Config"
2024-02-16 15:24:06 +05:00
DrawerType2 {
2023-06-05 15:49:10 +08:00
id: root
property string headerText
property string descriptionText
property string yesButtonText
property string noButtonText
property var yesButtonFunction
property var noButtonFunction
2024-12-31 04:16:52 +01:00
expandedStateContent: ColumnLayout {
id: content
2023-06-05 15:49:10 +08:00
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 8
2024-02-16 15:24:06 +05:00
onImplicitHeightChanged: {
root.expandedHeight = content.implicitHeight + 32
}
2023-06-05 15:49:10 +08:00
Header2TextType {
Layout.fillWidth: true
2024-02-16 15:24:06 +05:00
Layout.topMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
2023-06-05 15:49:10 +08:00
2025-05-13 12:29:33 +08:00
text: root.headerText
2023-06-05 15:49:10 +08:00
}
ParagraphTextType {
Layout.fillWidth: true
Layout.topMargin: 8
2024-02-16 15:24:06 +05:00
Layout.rightMargin: 16
Layout.leftMargin: 16
2023-06-05 15:49:10 +08:00
2025-05-13 12:29:33 +08:00
text: root.descriptionText
2023-06-05 15:49:10 +08:00
}
BasicButtonType {
2024-04-18 17:54:55 +04:00
id: yesButton
2023-06-05 15:49:10 +08:00
Layout.fillWidth: true
Layout.topMargin: 16
2024-02-16 15:24:06 +05:00
Layout.rightMargin: 16
Layout.leftMargin: 16
2023-06-05 15:49:10 +08:00
2025-05-13 12:29:33 +08:00
text: root.yesButtonText
2023-06-05 15:49:10 +08:00
clickedFunc: function() {
2025-05-13 12:29:33 +08:00
if (root.yesButtonFunction && typeof root.yesButtonFunction === "function") {
root.yesButtonFunction()
2023-06-05 15:49:10 +08:00
}
}
}
BasicButtonType {
2024-04-18 17:54:55 +04:00
id: noButton
2023-06-05 15:49:10 +08:00
Layout.fillWidth: true
2024-02-16 15:24:06 +05:00
Layout.rightMargin: 16
Layout.leftMargin: 16
2023-06-05 15:49:10 +08:00
2024-07-07 13:42:38 +03:00
defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite
disabledColor: AmneziaStyle.color.mutedGray
textColor: AmneziaStyle.color.paleGray
2023-06-05 15:49:10 +08:00
borderWidth: 1
2025-05-13 12:29:33 +08:00
visible: root.noButtonText !== ""
text: root.noButtonText
2023-06-05 15:49:10 +08:00
clickedFunc: function() {
2025-05-13 12:29:33 +08:00
if (root.noButtonFunction && typeof root.noButtonFunction === "function") {
root.noButtonFunction()
2023-06-05 15:49:10 +08:00
}
}
}
}
}