From dc4328bcdc7271411363d068299cb6f53baf1acd Mon Sep 17 00:00:00 2001 From: Tomas Mizera Date: Wed, 17 Apr 2024 17:34:31 +0200 Subject: [PATCH] Update MMFormValueMapEditor and MMFormValueRelationEditor --- .../form/editors/MMFormComboboxBaseEditor.qml | 54 +++---------------- app/qml/form/editors/MMFormValueMapEditor.qml | 4 +- .../editors/MMFormValueRelationEditor.qml | 4 +- 3 files changed, 10 insertions(+), 52 deletions(-) diff --git a/app/qml/form/editors/MMFormComboboxBaseEditor.qml b/app/qml/form/editors/MMFormComboboxBaseEditor.qml index 914e13e9a..dbebb809d 100644 --- a/app/qml/form/editors/MMFormComboboxBaseEditor.qml +++ b/app/qml/form/editors/MMFormComboboxBaseEditor.qml @@ -8,11 +8,9 @@ ***************************************************************************/ import QtQuick -import QtQuick.Controls -import QtQuick.Controls.Basic import "../../components" as MMComponents -import "../../inputs" as MMInputs +import "../../components/private" as MMPrivateComponents /* * Common dropdown (combobox) for forms (value relation and value map). @@ -21,63 +19,27 @@ import "../../inputs" as MMInputs * * Disabled state can be achieved by setting `enabled: false`. * - * See MMBaseInput for more properties. + * See MMBaseSingleLineInput for more properties. */ -MMInputs.MMBaseInput { +MMPrivateComponents.MMBaseSingleLineInput { id: root - property alias placeholderText: textField.placeholderText - property alias text: textField.text - property alias textFieldComponent: textField - property alias dropdownLoader: drawerLoader - hasFocus: textField.activeFocus - - content: TextField { - id: textField - - anchors.fill: parent - anchors.verticalCenter: parent.verticalCenter - + textField { readOnly: true - color: root.enabled ? __style.nightColor : __style.mediumGreenColor - placeholderTextColor: __style.darkGreyColor - - font: __style.p5 - hoverEnabled: true - - background: Rectangle { - color: __style.transparentColor - } - - MouseArea { - anchors.fill: parent - onClicked: function( mouse ) { - mouse.accepted = true - openDrawer() - } - } + onReleased: openDrawer() } - rightAction: MMComponents.MMIcon { - property bool pressed: false - - anchors.verticalCenter: parent.verticalCenter - + rightContent: MMComponents.MMIcon { size: __style.icon24 source: __style.arrowDownIcon - color: root.enabled ? __style.forestColor : __style.mediumGreenColor + color: root.editState === "enabled" ? __style.forestColor : __style.mediumGreenColor } - onRightActionClicked: { - if ( !root.enabled ) - return - - openDrawer() - } + onRightContentClicked: openDrawer() Loader { id: drawerLoader diff --git a/app/qml/form/editors/MMFormValueMapEditor.qml b/app/qml/form/editors/MMFormValueMapEditor.qml index f4eeca432..45c4c9f3d 100644 --- a/app/qml/form/editors/MMFormValueMapEditor.qml +++ b/app/qml/form/editors/MMFormValueMapEditor.qml @@ -47,13 +47,11 @@ MMFormComboboxBaseEditor { errorMsg: _fieldErrorMessage warningMsg: _fieldWarningMessage - enabled: !_fieldIsReadOnly + readOnly: _fieldIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState - textFieldComponent.color: __style.nightColor - onCheckboxCheckedChanged: { root.rememberValueBoxClicked( checkboxChecked ) } diff --git a/app/qml/form/editors/MMFormValueRelationEditor.qml b/app/qml/form/editors/MMFormValueRelationEditor.qml index aaad6c310..d43c5a950 100644 --- a/app/qml/form/editors/MMFormValueRelationEditor.qml +++ b/app/qml/form/editors/MMFormValueRelationEditor.qml @@ -48,13 +48,11 @@ MMFormComboboxBaseEditor { errorMsg: _fieldErrorMessage warningMsg: _fieldWarningMessage - enabled: !_fieldIsReadOnly + readOnly: _fieldIsReadOnly hasCheckbox: _fieldRememberValueSupported checkboxChecked: _fieldRememberValueState - textFieldComponent.color: __style.nightColor - on_FieldValueChanged: { vrModel.pair = root._fieldFeatureLayerPair }