Skip to content

Commit

Permalink
Update MMFormValueMapEditor and MMFormValueRelationEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasMizera committed Apr 17, 2024
1 parent a22fece commit dc4328b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 52 deletions.
54 changes: 8 additions & 46 deletions app/qml/form/editors/MMFormComboboxBaseEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions app/qml/form/editors/MMFormValueMapEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
}
Expand Down
4 changes: 1 addition & 3 deletions app/qml/form/editors/MMFormValueRelationEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit dc4328b

Please sign in to comment.