Skip to content

Commit

Permalink
Added resizable Text area item based on AbstractEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Dec 18, 2023
1 parent 8f869c9 commit 66e0c3d
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/qml/inputs/MMAbstractEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Item {
property bool hasCheckbox: false
property bool checkboxChecked: false

property real innerHeight: 50 * __dp

readonly property real spacing: 15 * __dp

width: parent.width
Expand Down Expand Up @@ -70,7 +72,7 @@ Item {
}

Item {
height: 50 * __dp
height: root.innerHeight
anchors.left: parent.left
anchors.right: parent.right

Expand Down
2 changes: 1 addition & 1 deletion app/qml/inputs/MMPasswordEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ MMAbstractEditor {
id: root

property alias placeholderText: textField.placeholderText
readonly property alias text: textField.text
property alias text: textField.text

hasFocus: textField.activeFocus

Expand Down
47 changes: 47 additions & 0 deletions app/qml/inputs/MMTextAreaEditor.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/***************************************************************************
* *
* 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 QtQuick.Controls.Basic
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import "../components"

MMAbstractEditor {
id: root

property var parentValue: parent.value ?? ""
property bool parentValueIsNull: parent.valueIsNull ?? false
property bool isReadOnly: parent.readOnly ?? false

property alias placeholderText: textArea.placeholderText
property alias text: textArea.text

signal editorValueChanged( var newValue, var isNull )

hasFocus: textArea.activeFocus
innerHeight: textArea.vertSpace + textArea.contentHeight + 2 * textArea.vertSpace

content: TextArea {
id: textArea

property real vertSpace: 11 * __dp

y: textArea.vertSpace
height: contentHeight + textArea.vertSpace
width: parent.width

hoverEnabled: true
placeholderTextColor: __style.nightAlphaColor
color: root.enabled ? __style.nightColor : __style.mediumGreenColor
font: __style.p5
wrapMode: Text.WordWrap
}
}
1 change: 1 addition & 0 deletions gallery/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@
<file>../app/qml/components/MMBackButton.qml</file>
<file>../app/qml/components/MMIconCheckBoxHorizontal.qml</file>
<file>../app/qml/components/MMIconCheckBoxVertical.qml</file>
<file>../app/qml/inputs/MMTextAreaEditor.qml</file>
</qresource>
</RCC>
10 changes: 9 additions & 1 deletion gallery/qml/pages/EditorsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,17 @@ ScrollView {
warningMsg: text.length > 0 ? "" : "Write something"
}

MMTextAreaEditor {
title: "MMTextAreaEditor"
placeholderText: "Place for multi row text"
enabled: checkbox.checked
width: parent.width
warningMsg: text.length > 0 ? "" : "Write something"
}

MMPasswordEditor {
title: "MMPasswordEditor"
parentValue: "Password"
text: "Password"
//regexp: '(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9])(?=.{6,})'
errorMsg: "Password must contain at least 6 characters\nMinimum 1 number, uppercase and lowercase letter and special character"
enabled: checkbox.checked
Expand Down

1 comment on commit 66e0c3d

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.12.498811 just submitted!

Please sign in to comment.