-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e4e35a
commit 3734e89
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
import QtQuick | ||
import QtQuick.Controls | ||
|
||
import "../../inputs" | ||
|
||
/* | ||
* Text Edit for QGIS Attribute Form | ||
* Requires various global properties set to function, see featureform Loader section. | ||
* These properties are injected here via 'fieldXYZ' properties and captured with underscore `_`. | ||
* | ||
* Should be used only within feature form. | ||
* See MMTextInput | ||
*/ | ||
|
||
MMTextInput { | ||
id: root | ||
|
||
property var _field: parent.field | ||
property var _fieldValue: parent.fieldValue | ||
property bool _fieldValueIsNull: parent.fieldValueIsNull | ||
|
||
property bool _fieldShouldShowTitle: parent.fieldShouldShowTitle | ||
property bool _fieldIsReadOnly: parent.fieldIsReadOnly | ||
|
||
property string _fieldTitle: parent.fieldTitle | ||
property string _fieldErrorMessage: parent.fieldErrorMessage | ||
property string _fieldWarningMessage: parent.fieldWarningMessage | ||
|
||
signal editorValueChanged( var newValue, bool isNull ) | ||
|
||
text: _fieldValue === undefined || _fieldValueIsNull ? '' : _fieldValue | ||
|
||
showClearIcon: false | ||
|
||
enabled: !_fieldIsReadOnly | ||
textFieldComponent.readOnly: _fieldIsReadOnly | ||
textFieldComponent.inputMethodHints: root._field.isNumeric ? Qt.ImhFormattedNumbersOnly : Qt.ImhNone | ||
|
||
title: _fieldShouldShowTitle ? _fieldTitle : "" | ||
|
||
warningMsg: _fieldWarningMessage | ||
errorMsg: _fieldErrorMessage | ||
|
||
textFieldComponent.maximumLength: { | ||
if ( ( !root._field.isNumeric ) && ( root._field.length > 0 ) ) { | ||
return root._field.length | ||
} | ||
return internal.textMaxCharactersLimit | ||
} | ||
|
||
onTextEdited: function ( text ) { | ||
let val = text | ||
if ( root._field.isNumeric ) | ||
{ | ||
val = val.replace( ",", "." ).replace( / /g, '' ) // replace comma with dot and remove spaces | ||
} | ||
|
||
root.editorValueChanged( val, val === "" ) | ||
} | ||
|
||
// Avoid Android's uncommited text | ||
textFieldComponent.onPreeditTextChanged: if ( __androidUtils.isAndroid ) Qt.inputMethod.commit() | ||
|
||
QtObject { | ||
id: internal | ||
|
||
property int textMaxCharactersLimit: 32767 // Qt default | ||
} | ||
} |
3734e89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS - version 24.01.512511 just submitted!