fix: design

This commit is contained in:
Richard Ramos 2020-11-18 13:40:08 -04:00 committed by Iuri Matias
parent 913a7e5b5d
commit 3d72e18fb9
1 changed files with 44 additions and 63 deletions

View File

@ -8,6 +8,9 @@ import "../../../imports"
ModalPopup { ModalPopup {
id: root id: root
property QtObject request property QtObject request
height: 286
closePolicy: Popup.NoAutoClose
onClosed: { onClosed: {
request.dialogReject(); request.dialogReject();
@ -15,51 +18,20 @@ ModalPopup {
} }
Component.onCompleted: { Component.onCompleted: {
switch (request.type) { root.title = request.securityOrigin;
case JavaScriptDialogRequest.DialogTypeAlert: message.text = request.message;
cancelButton.visible = false; if(request.type == JavaScriptDialogRequest.DialogTypeAlert){
title.text = qsTr("Alert"); cancelButton.visible = false;
message.text = request.message; }
prompt.text = ""; if(request.type == JavaScriptDialogRequest.DialogTypePrompt){
prompt.visible = false; prompt.text = request.defaultText;
break; prompt.visible = true;
case JavaScriptDialogRequest.DialogTypeConfirm: svMessage.height = 75;
title.text = qsTr("Confirm");
message.text = request.message;
prompt.text = "";
prompt.visible = false;
break;
case JavaScriptDialogRequest.DialogTypePrompt:
title.text = qsTr("Prompt");
message.text = request.message;
prompt.text = request.defaultText;
prompt.visible = true;
break;
} }
} }
Rectangle {
id: rectangle
height: 30
anchors.rightMargin: 0
anchors.leftMargin: 0
anchors.right: parent.right
anchors.left: parent.left
Text {
id: title
x: 54
y: 5
color: "#ffffff"
text: qsTr("Title")
font.pointSize: 12
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
ScrollView { ScrollView {
id: svMessage
width: parent.width width: parent.width
height: 100 height: 100
TextArea { TextArea {
@ -70,34 +42,43 @@ ModalPopup {
} }
} }
TextField { Input {
id: prompt id: prompt
width: 300 text: ""
height: 22 visible: false
Layout.fillWidth: true Layout.fillWidth: true
font.pointSize: 12 anchors.top: svMessage.bottom
} }
Button { footer: Item {
id: okButton anchors.top: parent.bottom
width: 90 anchors.right: parent.right
height: 30 anchors.bottom: root.bottom
text: qsTr("OK") anchors.left: parent.left
onClicked: {
request.dialogAccept(prompt.text); StyledButton {
close(); id: okButton
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
label: qsTr("Ok")
anchors.bottom: parent.bottom
onClicked: {
request.dialogAccept(prompt.text);
close();
}
} }
}
Button { StyledButton {
id: cancelButton id: cancelButton
width: 90 anchors.right: okButton.left
height: 30 anchors.rightMargin: Style.current.smallPadding
anchors.top: okButton.bottom label: qsTr("Cancel")
text: qsTr("Cancel") btnColor: Style.current.transparent
onClicked: { anchors.bottom: parent.bottom
request.dialogReject(); onClicked: {
close(); request.dialogReject();
close();
}
} }
} }
} }