diff --git a/app/qml/components/private/MMBaseInput.qml b/app/qml/components/private/MMBaseInput.qml index 128830641..0044acf53 100644 --- a/app/qml/components/private/MMBaseInput.qml +++ b/app/qml/components/private/MMBaseInput.qml @@ -28,6 +28,7 @@ Item { property alias checkboxChecked: checkbox.checked property bool readOnly: false + property bool shouldShowValidation: true property string errorMsg: "" property string warningMsg: "" @@ -64,7 +65,7 @@ Item { states: [ State { name: "valid" - when: !warningMsg && !errorMsg + when: !shouldShowValidation || ( !warningMsg && !errorMsg ) }, State { name: "error" @@ -170,7 +171,7 @@ Item { width: parent.width height: validationMessagegroup.implicitHeight - visible: root.validationState !== "valid" && root.editState === "enabled" + visible: root.validationState !== "valid" && root.shouldShowValidation RowLayout { id: validationMessagegroup diff --git a/app/qml/form/MMFormPage.qml b/app/qml/form/MMFormPage.qml index 228533669..912661501 100644 --- a/app/qml/form/MMFormPage.qml +++ b/app/qml/form/MMFormPage.qml @@ -281,7 +281,9 @@ Page { property var fieldWidget: model.EditorWidget property var fieldConfig: model.EditorWidgetConfig - property bool fieldIsReadOnly: root.state === "readOnly" || !AttributeEditable + property bool fieldFormIsReadOnly: root.state === "readOnly" + property bool fieldIsEditable: AttributeEditable + property bool fieldShouldShowTitle: model.ShowName property string fieldTitle: model.Name diff --git a/app/qml/form/editors/MMFormCalendarEditor.qml b/app/qml/form/editors/MMFormCalendarEditor.qml index 37a018bf2..a01f414fe 100644 --- a/app/qml/form/editors/MMFormCalendarEditor.qml +++ b/app/qml/form/editors/MMFormCalendarEditor.qml @@ -31,7 +31,8 @@ MMPrivateComponents.MMBaseSingleLineInput { property bool _fieldValueIsNull: parent.fieldValueIsNull property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -58,7 +59,8 @@ MMPrivateComponents.MMBaseSingleLineInput { hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly onCheckboxCheckedChanged: { root.rememberValueBoxClicked( checkboxChecked ) diff --git a/app/qml/form/editors/MMFormNumberEditor.qml b/app/qml/form/editors/MMFormNumberEditor.qml index 3ae2a070d..ae1d894dd 100644 --- a/app/qml/form/editors/MMFormNumberEditor.qml +++ b/app/qml/form/editors/MMFormNumberEditor.qml @@ -28,7 +28,8 @@ MMPrivateComponents.MMBaseSingleLineInput { property bool _fieldValueIsNull: parent.fieldValueIsNull property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -41,7 +42,8 @@ MMPrivateComponents.MMBaseSingleLineInput { signal rememberValueBoxClicked( bool state ) title: _fieldShouldShowTitle ? _fieldTitle : "" - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly errorMsg: _fieldErrorMessage warningMsg: _fieldWarningMessage diff --git a/app/qml/form/editors/MMFormPhotoEditor.qml b/app/qml/form/editors/MMFormPhotoEditor.qml index 12af68b94..9f586c596 100644 --- a/app/qml/form/editors/MMFormPhotoEditor.qml +++ b/app/qml/form/editors/MMFormPhotoEditor.qml @@ -63,7 +63,8 @@ MMFormPhotoViewer { property var _fieldFeatureLayerPair: parent.fieldFeatureLayerPair property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -80,7 +81,8 @@ MMFormPhotoViewer { warningMsg: photoState === "notAvailable" ? qsTr( "Photo is missing." ) : _fieldWarningMessage errorMsg: _fieldErrorMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormRelationReferenceEditor.qml b/app/qml/form/editors/MMFormRelationReferenceEditor.qml index e681c987d..47d41c56c 100644 --- a/app/qml/form/editors/MMFormRelationReferenceEditor.qml +++ b/app/qml/form/editors/MMFormRelationReferenceEditor.qml @@ -22,7 +22,8 @@ MMPrivateComponents.MMBaseSingleLineInput { property var _fieldConfig: parent.fieldConfig property var _fieldActiveProject: parent.fieldActiveProject - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle property string _fieldTitle: parent.fieldTitle @@ -45,7 +46,8 @@ MMPrivateComponents.MMBaseSingleLineInput { errorMsg: _fieldErrorMessage warningMsg: _fieldWarningMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormScannerEditor.qml b/app/qml/form/editors/MMFormScannerEditor.qml index f2defc302..4aa4fd0de 100644 --- a/app/qml/form/editors/MMFormScannerEditor.qml +++ b/app/qml/form/editors/MMFormScannerEditor.qml @@ -28,7 +28,8 @@ MMPrivateComponents.MMBaseSingleLineInput { property bool _fieldValueIsNull: parent.fieldValueIsNull property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -45,7 +46,8 @@ MMPrivateComponents.MMBaseSingleLineInput { warningMsg: _fieldWarningMessage errorMsg: _fieldErrorMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormSliderEditor.qml b/app/qml/form/editors/MMFormSliderEditor.qml index 6465ecc62..de34005e3 100644 --- a/app/qml/form/editors/MMFormSliderEditor.qml +++ b/app/qml/form/editors/MMFormSliderEditor.qml @@ -28,7 +28,8 @@ MMPrivateComponents.MMBaseSingleLineInput { property var _fieldConfig: parent.fieldConfig property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -45,7 +46,8 @@ MMPrivateComponents.MMBaseSingleLineInput { warningMsg: _fieldWarningMessage errorMsg: _fieldErrorMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormSwitchEditor.qml b/app/qml/form/editors/MMFormSwitchEditor.qml index 7c7ff20cc..aac2b388b 100644 --- a/app/qml/form/editors/MMFormSwitchEditor.qml +++ b/app/qml/form/editors/MMFormSwitchEditor.qml @@ -28,7 +28,8 @@ MMSwitchInput { property var _fieldConfig: parent.fieldConfig property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -45,7 +46,8 @@ MMSwitchInput { warningMsg: _fieldWarningMessage errorMsg: _fieldErrorMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormTextEditor.qml b/app/qml/form/editors/MMFormTextEditor.qml index 10ec5358e..07cc0a9d4 100644 --- a/app/qml/form/editors/MMFormTextEditor.qml +++ b/app/qml/form/editors/MMFormTextEditor.qml @@ -29,7 +29,8 @@ MMPrivateComponents.MMBaseSingleLineInput { property bool _fieldValueIsNull: parent.fieldValueIsNull property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -43,7 +44,8 @@ MMPrivateComponents.MMBaseSingleLineInput { text: _fieldValue === undefined || _fieldValueIsNull ? '' : _fieldValue - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly title: _fieldShouldShowTitle ? _fieldTitle : "" diff --git a/app/qml/form/editors/MMFormTextMultilineEditor.qml b/app/qml/form/editors/MMFormTextMultilineEditor.qml index f93e54253..c9aaae1b0 100644 --- a/app/qml/form/editors/MMFormTextMultilineEditor.qml +++ b/app/qml/form/editors/MMFormTextMultilineEditor.qml @@ -31,7 +31,8 @@ MMPrivateComponents.MMBaseInput { property bool _fieldValueIsNull: parent.fieldValueIsNull property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -49,7 +50,8 @@ MMPrivateComponents.MMBaseInput { warningMsg: _fieldWarningMessage errorMsg: _fieldErrorMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormValueMapEditor.qml b/app/qml/form/editors/MMFormValueMapEditor.qml index 45c4c9f3d..28497a08d 100644 --- a/app/qml/form/editors/MMFormValueMapEditor.qml +++ b/app/qml/form/editors/MMFormValueMapEditor.qml @@ -28,7 +28,8 @@ MMFormComboboxBaseEditor { property bool _fieldValueIsNull: parent.fieldValueIsNull property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -47,7 +48,8 @@ MMFormComboboxBaseEditor { errorMsg: _fieldErrorMessage warningMsg: _fieldWarningMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/app/qml/form/editors/MMFormValueRelationEditor.qml b/app/qml/form/editors/MMFormValueRelationEditor.qml index 59f7837a8..e98643ed2 100644 --- a/app/qml/form/editors/MMFormValueRelationEditor.qml +++ b/app/qml/form/editors/MMFormValueRelationEditor.qml @@ -31,7 +31,8 @@ MMFormComboboxBaseEditor { property var _fieldFeatureLayerPair: parent.fieldFeatureLayerPair property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle - property bool _fieldIsReadOnly: parent.fieldIsReadOnly + property bool _fieldFormIsReadOnly: parent.fieldFormIsReadOnly + property bool _fieldIsEditable: parent.fieldIsEditable property string _fieldTitle: parent.fieldTitle property string _fieldErrorMessage: parent.fieldErrorMessage @@ -48,7 +49,8 @@ MMFormComboboxBaseEditor { errorMsg: _fieldErrorMessage warningMsg: _fieldWarningMessage - readOnly: _fieldIsReadOnly + readOnly: _fieldFormIsReadOnly || !_fieldIsEditable + shouldShowValidation: !_fieldFormIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState diff --git a/gallery/qml/components/EditorItem.qml b/gallery/qml/components/EditorItem.qml index 11f4884c9..d00936ab1 100644 --- a/gallery/qml/components/EditorItem.qml +++ b/gallery/qml/components/EditorItem.qml @@ -21,7 +21,8 @@ Item { property string fieldValue: "" property var fieldConfig: ({UseHtml: true}) property bool fieldShouldShowTitle: checkboxTitle.checked - property bool fieldIsReadOnly: !checkbox.checked + property bool fieldFormIsReadOnly: !checkbox.checked + property bool fieldIsEditable: checkboxEditable.checked property string fieldErrorMessage: checkboxError.checked ? "error" : "" property string fieldWarningMessage: checkboxWarning.checked ? "warning" : "" property bool fieldRememberValueSupported: checkboxRemember.checked diff --git a/gallery/qml/pages/EditorsPage.qml b/gallery/qml/pages/EditorsPage.qml index f571a6c89..b2ddb5462 100644 --- a/gallery/qml/pages/EditorsPage.qml +++ b/gallery/qml/pages/EditorsPage.qml @@ -67,6 +67,12 @@ ScrollView { checked: false } + MMCheckBox { + id: checkboxEditable + text: checked ? "attribute editable: yes" : "attribute editable: no" + checked: true + } + GalleryComponents.EditorItem { width: parent.width height: relationEditor.height