From a6256ecb00bfa8a21eb06e0b9f0c43ea1bc965c0 Mon Sep 17 00:00:00 2001 From: talksik Date: Fri, 11 Apr 2025 14:11:51 -0700 Subject: [PATCH] feat: add text field --- AppTextField.qml | 18 ++++++++++++++++++ AppWindow.qml | 1 + CMakeLists.txt | 1 + gallery/Main.qml | 4 ++++ 4 files changed, 24 insertions(+) create mode 100644 AppTextField.qml diff --git a/AppTextField.qml b/AppTextField.qml new file mode 100644 index 0000000..de1f1e5 --- /dev/null +++ b/AppTextField.qml @@ -0,0 +1,18 @@ +import QtQuick +import DesignSystem +import QtQuick.Controls.Basic +import QtQuick.Controls.impl + +TextField { + id: control + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 40 + border.width: control.activeFocus ? 2 : 1 + color: control.palette.base + border.color: control.activeFocus ? control.palette.highlight : control.palette.mid + + radius: Theme.radius + } +} diff --git a/AppWindow.qml b/AppWindow.qml index be6648c..4887dbe 100644 --- a/AppWindow.qml +++ b/AppWindow.qml @@ -19,6 +19,7 @@ ApplicationWindow { light: Theme.secondaryText highlight: Theme.muted highlightedText: Theme.secondaryBackground + placeholderText: Theme.muted } title: qsTr("Flowy") diff --git a/CMakeLists.txt b/CMakeLists.txt index 4224c20..cef9504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ set(plain_qml_files AppLogo.qml AppWindow.qml AppComboBox.qml + AppTextField.qml ) set(qml_singletons Fonts.qml diff --git a/gallery/Main.qml b/gallery/Main.qml index 4a109f8..23a74a5 100644 --- a/gallery/Main.qml +++ b/gallery/Main.qml @@ -93,5 +93,9 @@ AppWindow { model.append({text: editText}) } } + + AppTextField { + placeholderText: qsTr("Enter name") + } } }