From 2adb0ca74ac2a3f993824ea86e9a3233dcacb9e5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 8 Sep 2017 11:21:11 +0200 Subject: RequiredTextField with some basic validation --- framework/qml/RequiredTextField.qml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 framework/qml/RequiredTextField.qml (limited to 'framework/qml') 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 @@ +/* + * Copyright (C) 2017 Michael Bohlender, + * Copyright (C) 2017 Christian Mollekopf, + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.7 +import org.kube.framework 1.0 as Kube + +Kube.TextField { + id: root + validator: RegExpValidator { regExp: /.*\S.*/ } + Rectangle { + anchors.fill: parent + opacity: 0.2 + color: Kube.Colors.warningColor + visible: !root.acceptableInput + } +} -- cgit v1.2.3