aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/ios/TextField.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/ios/TextField.qml')
-rw-r--r--src/quickcontrols/ios/TextField.qml55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/quickcontrols/ios/TextField.qml b/src/quickcontrols/ios/TextField.qml
new file mode 100644
index 0000000000..4b5a1fb48e
--- /dev/null
+++ b/src/quickcontrols/ios/TextField.qml
@@ -0,0 +1,55 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Templates as T
+import QtQuick.Controls.impl
+import QtQuick.Controls.iOS.impl
+
+
+T.TextField {
+ id: control
+
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
+ placeholder.implicitHeight + topPadding + bottomPadding)
+
+ padding: 6
+ topPadding: 7
+ bottomPadding: 7
+
+ color: control.palette.text
+ selectionColor: control.palette.highlight
+ selectedTextColor: control.palette.highlightedText
+ placeholderTextColor: control.palette.placeholderText
+ verticalAlignment: Qt.AlignVCenter
+ cursorDelegate: CursorDelegate {}
+
+ PlaceholderText {
+ id: placeholder
+ x: control.leftPadding
+ y: control.topPadding
+ width: control.width - (control.leftPadding + control.rightPadding)
+ height: control.height - (control.topPadding + control.bottomPadding)
+
+ text: control.placeholderText
+ font: control.font
+ color: control.placeholderTextColor
+ verticalAlignment: control.verticalAlignment
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ elide: Text.ElideRight
+ renderType: control.renderType
+ }
+
+ background: Rectangle {
+ implicitHeight: 34
+ implicitWidth: 97
+ radius: 4
+
+ border.width: 0.5
+ border.color: control.palette.mid
+ color: control.palette.base
+ }
+}