2023-03-06 18:22:36 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2023-03-07 00:05:27 +08:00
|
|
|
|
import QtQuick.Window 2.15
|
2023-03-06 18:22:36 +08:00
|
|
|
|
|
|
|
|
|
Popup {
|
|
|
|
|
id: popup
|
|
|
|
|
|
2023-03-07 00:05:27 +08:00
|
|
|
|
property string title: "Title"
|
|
|
|
|
property string message: "Messaeg"
|
|
|
|
|
property string negativeText: "Negative"
|
|
|
|
|
property string positiveText: "Positive"
|
|
|
|
|
signal negativeClicked
|
|
|
|
|
signal positiveClicked
|
|
|
|
|
|
|
|
|
|
property var minWidth: {
|
|
|
|
|
if(Window.window==null)
|
|
|
|
|
return 400
|
|
|
|
|
return Math.min(Window.window.width,400)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modal:true
|
|
|
|
|
anchors.centerIn: Overlay.overlay
|
|
|
|
|
closePolicy: Popup.CloseOnEscape
|
2023-03-06 18:22:36 +08:00
|
|
|
|
background: Rectangle {
|
2023-03-07 00:05:27 +08:00
|
|
|
|
implicitWidth:minWidth
|
|
|
|
|
implicitHeight: text_title.height + text_message.height + layout_actions.height
|
|
|
|
|
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
|
|
|
|
radius:5
|
2023-03-06 18:22:36 +08:00
|
|
|
|
FluShadow{
|
|
|
|
|
radius: 5
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-07 00:05:27 +08:00
|
|
|
|
FluText{
|
|
|
|
|
id:text_title
|
|
|
|
|
fontStyle: FluText.TitleLarge
|
|
|
|
|
text:title
|
|
|
|
|
topPadding: 20
|
|
|
|
|
leftPadding: 20
|
|
|
|
|
rightPadding: 20
|
|
|
|
|
wrapMode: Text.WrapAnywhere
|
|
|
|
|
anchors{
|
|
|
|
|
top:parent.top
|
|
|
|
|
left: parent.left
|
|
|
|
|
right: parent.right
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FluText{
|
|
|
|
|
id:text_message
|
|
|
|
|
fontStyle: FluText.Body
|
|
|
|
|
wrapMode: Text.WrapAnywhere
|
|
|
|
|
text:message
|
|
|
|
|
topPadding: 14
|
|
|
|
|
leftPadding: 20
|
|
|
|
|
rightPadding: 20
|
|
|
|
|
bottomPadding: 14
|
|
|
|
|
anchors{
|
|
|
|
|
top:text_title.bottom
|
|
|
|
|
left: parent.left
|
|
|
|
|
right: parent.right
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle{
|
|
|
|
|
id:layout_actions
|
|
|
|
|
height: 68
|
|
|
|
|
radius: 5
|
|
|
|
|
color: FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
|
|
|
|
anchors{
|
|
|
|
|
top:text_message.bottom
|
|
|
|
|
left: parent.left
|
|
|
|
|
right: parent.right
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id:divider
|
|
|
|
|
width: 1
|
|
|
|
|
height: parent.height
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FluButton{
|
|
|
|
|
anchors{
|
|
|
|
|
left: parent.left
|
|
|
|
|
leftMargin: 20
|
|
|
|
|
rightMargin: 10
|
|
|
|
|
right: divider.left
|
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
text: negativeText
|
|
|
|
|
onClicked: {
|
|
|
|
|
popup.close()
|
|
|
|
|
negativeClicked()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FluFilledButton{
|
|
|
|
|
anchors{
|
|
|
|
|
right: parent.right
|
|
|
|
|
left: divider.right
|
|
|
|
|
rightMargin: 20
|
|
|
|
|
leftMargin: 10
|
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
|
}
|
|
|
|
|
text: positiveText
|
|
|
|
|
onClicked: {
|
|
|
|
|
popup.close()
|
|
|
|
|
positiveClicked()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2023-03-06 18:22:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|