parent
1c910deca9
commit
b4de0da9f7
|
@ -14,7 +14,6 @@ ModalPopup {
|
||||||
property bool isEdit: false
|
property bool isEdit: false
|
||||||
property bool isValid:
|
property bool isValid:
|
||||||
nameInput.isValid &&
|
nameInput.isValid &&
|
||||||
addImageButton.isValid &&
|
|
||||||
descriptionTextArea.isValid &&
|
descriptionTextArea.isValid &&
|
||||||
colorPicker.isValid
|
colorPicker.isValid
|
||||||
|
|
||||||
|
@ -32,7 +31,6 @@ ModalPopup {
|
||||||
|
|
||||||
function validate() {
|
function validate() {
|
||||||
nameInput.validate()
|
nameInput.validate()
|
||||||
addImageButton.validate()
|
|
||||||
descriptionTextArea.validate()
|
descriptionTextArea.validate()
|
||||||
colorPicker.validate()
|
colorPicker.validate()
|
||||||
return isValid
|
return isValid
|
||||||
|
@ -164,23 +162,8 @@ ModalPopup {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: thumbnailText.bottom
|
anchors.top: thumbnailText.bottom
|
||||||
anchors.topMargin: Style.current.padding
|
anchors.topMargin: Style.current.padding
|
||||||
property bool isValid: false
|
|
||||||
property string selectedImage: ""
|
property string selectedImage: ""
|
||||||
|
|
||||||
onSelectedImageChanged: validate()
|
|
||||||
|
|
||||||
function resetValidation() {
|
|
||||||
isValid = false
|
|
||||||
imageValidation.text = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function validate() {
|
|
||||||
imageValidation.text = ""
|
|
||||||
if (selectedImage === "") {
|
|
||||||
imageValidation.text = qsTr("Please select an image")
|
|
||||||
}
|
|
||||||
isValid = imageValidation.text === ""
|
|
||||||
}
|
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: imageDialog
|
id: imageDialog
|
||||||
|
@ -191,9 +174,6 @@ ModalPopup {
|
||||||
//% "Image files (*.jpg *.jpeg *.png)"
|
//% "Image files (*.jpg *.jpeg *.png)"
|
||||||
qsTrId("image-files----jpg---jpeg---png-")
|
qsTrId("image-files----jpg---jpeg---png-")
|
||||||
]
|
]
|
||||||
onRejected: {
|
|
||||||
addImageButton.validate()
|
|
||||||
}
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
addImageButton.selectedImage = imageDialog.fileUrls[0]
|
addImageButton.selectedImage = imageDialog.fileUrls[0]
|
||||||
imageCropperModal.open()
|
imageCropperModal.open()
|
||||||
|
|
Loading…
Reference in New Issue