summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-08 11:21:11 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-08 11:21:11 +0200
commit2adb0ca74ac2a3f993824ea86e9a3233dcacb9e5 (patch)
treef7c4d31ac12c436760a872c86d8f8605c0e357e0
parent6f4e9230a88bc2262a1093ae9f2507f1160bff54 (diff)
downloadkube-2adb0ca74ac2a3f993824ea86e9a3233dcacb9e5.tar.gz
kube-2adb0ca74ac2a3f993824ea86e9a3233dcacb9e5.zip
RequiredTextField with some basic validation
-rw-r--r--framework/qml/RequiredTextField.qml32
-rw-r--r--framework/qmldir1
2 files changed, 33 insertions, 0 deletions
diff --git a/framework/qml/RequiredTextField.qml b/framework/qml/RequiredTextField.qml
new file mode 100644
index 00000000..2e3512a4
--- /dev/null
+++ b/framework/qml/RequiredTextField.qml
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
3 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import org.kube.framework 1.0 as Kube
22
23Kube.TextField {
24 id: root
25 validator: RegExpValidator { regExp: /.*\S.*/ }
26 Rectangle {
27 anchors.fill: parent
28 opacity: 0.2
29 color: Kube.Colors.warningColor
30 visible: !root.acceptableInput
31 }
32}
diff --git a/framework/qmldir b/framework/qmldir
index 6b3f355c..461bd653 100644
--- a/framework/qmldir
+++ b/framework/qmldir
@@ -24,6 +24,7 @@ CheckBox 1.0 CheckBox.qml
24PositiveButton 1.0 PositiveButton.qml 24PositiveButton 1.0 PositiveButton.qml
25TextButton 1.0 TextButton.qml 25TextButton 1.0 TextButton.qml
26TextField 1.0 TextField.qml 26TextField 1.0 TextField.qml
27RequiredTextField 1.0 RequiredTextField.qml
27PasswordField 1.0 PasswordField.qml 28PasswordField 1.0 PasswordField.qml
28TextArea 1.0 TextArea.qml 29TextArea 1.0 TextArea.qml
29TextEditor 1.0 TextEditor.qml 30TextEditor 1.0 TextEditor.qml