Skip to content

Commit

Permalink
Added Input with right icon
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Dec 20, 2023
1 parent dada108 commit c936a27
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 4 deletions.
2 changes: 0 additions & 2 deletions app/qml/inputs/MMInputEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import "../components"

MMAbstractEditor {
Expand Down
53 changes: 53 additions & 0 deletions app/qml/inputs/MMInputWithRightIconEditor.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/***************************************************************************
* *
* 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 "../components"

MMAbstractEditor {
id: root

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

property alias placeholderText: textField.placeholderText
property alias text: textField.text
property alias iconSource: rightIcon.source

signal editorValueChanged( var newValue, var isNull )

hasFocus: textField.activeFocus

content: TextField {
id: textField

anchors.fill: parent

text: root.parentValue
color: root.enabled ? __style.nightColor : __style.mediumGreenColor
placeholderTextColor: __style.nightAlphaColor
font: __style.p5
hoverEnabled: true

background: Rectangle {
color: __style.transparentColor
}
}

rightAction: MMIcon {
id: rightIcon

height: parent.height

color: root.enabled ? __style.forestColor : __style.mediumGreenColor
}
}
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
1 change: 1 addition & 0 deletions gallery/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,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/MMInputWithRightIconEditor.qml</file>
</qresource>
</RCC>
12 changes: 11 additions & 1 deletion gallery/qml/pages/EditorsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,19 @@ ScrollView {
warningMsg: text.length > 0 ? "" : "Write something"
}

MMInputWithRightIconEditor {
title: "MMInputWithRightIconEditor"
placeholderText: "Placeholder"
enabled: checkbox.checked
width: parent.width
warningMsg: text.length > 0 ? "" : "Press button to scan"
iconSource: __style.qrCodeIcon
onRightActionClicked: { console.log("Show scan input"); text = "Scanned text ..." }
}

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 c936a27

@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.500811 just submitted!

Please sign in to comment.