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

110 lines
2.5 KiB
QML
Raw Normal View History

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-02-16 15:24:06 +05:00
expandedContent: 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
}
2024-04-18 17:54:55 +04:00
Connections {
target: root
enabled: !GC.isMobile()
function onOpened() {
focusItem.forceActiveFocus()
}
}
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
text: headerText
}
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
text: descriptionText
}
2024-04-18 17:54:55 +04:00
Item {
id: focusItem
KeyNavigation.tab: yesButton
}
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
text: yesButtonText
clickedFunc: function() {
2023-06-05 15:49:10 +08:00
if (yesButtonFunction && typeof yesButtonFunction === "function") {
yesButtonFunction()
}
}
2024-04-18 17:54:55 +04:00
KeyNavigation.tab: noButton
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.blackHovered
pressedColor: AmneziaStyle.color.blackPressed
disabledColor: AmneziaStyle.color.grey
textColor: AmneziaStyle.color.white
2023-06-05 15:49:10 +08:00
borderWidth: 1
text: noButtonText
clickedFunc: function() {
2023-06-05 15:49:10 +08:00
if (noButtonFunction && typeof noButtonFunction === "function") {
noButtonFunction()
}
}
2024-04-18 17:54:55 +04:00
KeyNavigation.tab: focusItem
2023-06-05 15:49:10 +08:00
}
}
}