From 9a8c9b16fddd96ec2705f64d7023aedcde71d6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 23 Mar 2023 09:52:23 +0800 Subject: Auth & Shop reuse custom TextField --- Authentication/SignIn.ui.qml | 21 +++------------- Authentication/SignUp.ui.qml | 31 +++-------------------- Eduport.qrc | 1 + Shop/Checkout.ui.qml | 60 ++++++++------------------------------------ TextField/Input.ui.qml | 15 +++++++++++ 5 files changed, 33 insertions(+), 95 deletions(-) create mode 100644 TextField/Input.ui.qml diff --git a/Authentication/SignIn.ui.qml b/Authentication/SignIn.ui.qml index cb634a1..f36f61d 100644 --- a/Authentication/SignIn.ui.qml +++ b/Authentication/SignIn.ui.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.15 import Bootstrap 5.3 import Eduport 1.4 import "../Label" as Lbl +import "../TextField" as TxtFld import "../Button" as BsBtn Flickable { @@ -74,19 +75,11 @@ Flickable { Layout.margins: 16 } - TextField { + TxtFld.Input { id: email placeholderText: qsTr("E-mail") - font { - family: Bootstrap.bodyFont.family - weight: Bootstrap.bodyFont.weight - pointSize: Eduport.formControlFontSize - } Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -114,20 +107,12 @@ Flickable { Layout.margins: 16 } - TextField { + TxtFld.Input { id: password placeholderText: qsTr("password") echoMode: TextInput.Password - font { - family: Bootstrap.bodyFont.family - weight: Bootstrap.bodyFont.weight - pointSize: Eduport.formControlFontSize - } Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } diff --git a/Authentication/SignUp.ui.qml b/Authentication/SignUp.ui.qml index 8367fbf..683ee7b 100644 --- a/Authentication/SignUp.ui.qml +++ b/Authentication/SignUp.ui.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.15 import Bootstrap 5.3 import Eduport 1.4 import "../Label" as Lbl +import "../TextField" as TxtFld import "../Button" as BsBtn Flickable { @@ -77,19 +78,11 @@ Flickable { Layout.margins: 16 } - TextField { + TxtFld.Input { id: email placeholderText: qsTr("E-mail") - font { - family: Bootstrap.bodyFont.family - weight: Bootstrap.bodyFont.weight - pointSize: Eduport.formControlFontSize - } Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -118,20 +111,12 @@ Flickable { Layout.margins: 16 } - TextField { + TxtFld.Input { id: password placeholderText: "*********" echoMode: TextInput.Password - font { - family: Bootstrap.bodyFont.family - weight: Bootstrap.bodyFont.weight - pointSize: Eduport.formControlFontSize - } Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -160,20 +145,12 @@ Flickable { Layout.margins: 16 } - TextField { + TxtFld.Input { id: confirmPassword placeholderText: "*********" echoMode: TextInput.Password - font { - family: Bootstrap.bodyFont.family - weight: Bootstrap.bodyFont.weight - pointSize: Eduport.formControlFontSize - } Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } diff --git a/Eduport.qrc b/Eduport.qrc index 984d8db..007b787 100644 --- a/Eduport.qrc +++ b/Eduport.qrc @@ -9,6 +9,7 @@ imports/Eduport/qmldir Label/Hx.ui.qml Label/Body.ui.qml + TextField/Input.ui.qml Button/Primary.ui.qml diff --git a/Shop/Checkout.ui.qml b/Shop/Checkout.ui.qml index 6768217..97125c5 100644 --- a/Shop/Checkout.ui.qml +++ b/Shop/Checkout.ui.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import Bootstrap 5.3 import Eduport 1.4 +import "../TextField" as TxtFld import "../Label" as Lbl Flickable { @@ -110,16 +111,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: name placeholderText: qsTr("Name") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -140,16 +136,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: email placeholderText: qsTr("Email") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -170,16 +161,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: mobile placeholderText: qsTr("Mobile number") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -199,16 +185,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: country placeholderText: qsTr("Select country") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -229,17 +210,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: province - placeholderText: qsTr( - "Select state") - font.pointSize: 16 - font.family: "roboto" + placeholderText: qsTr("Select state") Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -260,16 +235,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: postal placeholderText: qsTr("PIN code") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -290,16 +260,11 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { id: address placeholderText: qsTr("Address") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } @@ -490,15 +455,10 @@ Flickable { Layout.fillWidth: true RowLayout { anchors.fill: parent - TextField { + TxtFld.Input { placeholderText: qsTr("COUPON CODE") - font.pointSize: 16 - font.family: "roboto" Layout.fillWidth: true Layout.fillHeight: true - background: Rectangle { - color: "transparent" - } } } } diff --git a/TextField/Input.ui.qml b/TextField/Input.ui.qml new file mode 100644 index 0000000..a161582 --- /dev/null +++ b/TextField/Input.ui.qml @@ -0,0 +1,15 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import Bootstrap 5.3 +import Eduport 1.4 + +TextField { + font { + family: Bootstrap.bodyFont.family + weight: Bootstrap.bodyFont.weight + pointSize: Eduport.formControlFontSize + } + background: Rectangle { + color: "transparent" + } +} -- cgit v1.2.3