feat(SQ/StatusInput): Added new property to override char limit label

Added `charLimitLabel`. If it is set, the default char limit label will be overriden.
This commit is contained in:
Noelia 2023-05-22 17:11:50 +02:00 committed by Noelia
parent f3a6b135a3
commit 0862273baf
1 changed files with 7 additions and 2 deletions

View File

@ -111,6 +111,11 @@ Item {
This property sets the character limit of the text input. This property sets the character limit of the text input.
*/ */
property int charLimit: 0 property int charLimit: 0
/*!
\qmlproperty string StatusInput::charLimitLabel
This property overrides the char default chart limit text format.
*/
property string charLimitLabel: ""
/*! /*!
\qmlproperty string StatusInput::errorMessage \qmlproperty string StatusInput::errorMessage
This property sets the error message text. This property sets the error message text.
@ -417,11 +422,11 @@ Item {
} }
StatusBaseText { StatusBaseText {
id: charLimitLabel id: charLimitLabelItem
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
height: visible ? contentHeight : 0 height: visible ? contentHeight : 0
visible: root.charLimit > 0 visible: root.charLimit > 0
text: "%1 / %2".arg(Utils.encodeUtf8(statusBaseInput.text).length).arg(root.charLimit) text: root.charLimitLabel ? root.charLimitLabel : "%1 / %2".arg(Utils.encodeUtf8(statusBaseInput.text).length).arg(root.charLimit)
font.pixelSize: 12 font.pixelSize: 12
color: statusBaseInput.enabled ? Theme.palette.baseColor1 : Theme.palette.directColor6 color: statusBaseInput.enabled ? Theme.palette.baseColor1 : Theme.palette.directColor6
} }