Skip to content

Feat: Text Field UI Widget #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Editor/Qml/ETextField.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic

Item {
property string placeHolderText: ''
property int wrapMode: TextInput.NoWrap
property string text: ''

id: root
implicitWidth: textField.implicitWidth
implicitHeight: textField.implicitHeight

TextField {
id: textField
width: root.width
height: root.height
implicitWidth: 500
text: root.text
rightPadding: 10
color: ETheme.fontColor
placeholderText: root.placeHolderText
placeholderTextColor: ETheme.placeHolderFontColor
font.pixelSize: ETheme.contentFontSize
font.family: ETheme.fontFamily
wrapMode: root.wrapMode

background: Rectangle {
radius: 5
color: ETheme.primaryBgColor
}
}
}
5 changes: 3 additions & 2 deletions Editor/Qml/ETheme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import QtQuick

QtObject {
property color bgColor: Qt.color('#212121')
property color primaryBgColor: Qt.color('#2a2a2a')
property color primaryBgColor: Qt.color('#3a3939')
property color primaryColor: Qt.color('#e74c3c')
property color primaryHoverColor: Qt.color('#ce4d40')
property color primaryFocusColor: Qt.color('#c0392b')
property color primaryDisabledColor: Qt.color('#4b4a49')
property color secondaryColor: Qt.color('#d58845')
property color secondaryHoverColor: Qt.color('#d58845')
property color secondaryFocusColor: Qt.color('#9b6a40')
property color secondaryBgColor: Qt.color('#8e8e8e')
property color disabledColor: Qt.color('#676563')
property color fontColor: Qt.color('#ecf0f1')
property color placeHolderFontColor: Qt.color('#c0c3c4')
property color linkFontColor: Qt.color('#91b9c4')
property color secondaryBgColor: Qt.color('#8e8e8e')

property FontLoader normalFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Medium.ttf') }
property FontLoader boldFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Semibold.ttf') }
Expand Down
56 changes: 56 additions & 0 deletions Editor/Qml/EWidgetSamples.qml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,62 @@ Rectangle {
filler: ESwitch.Filler.Text
}
}

RowLayout {
Layout.leftMargin: 5
Layout.topMargin: 15
EText {
text: 'TextInput'
style: EText.Style.Title1
}
}

ColumnLayout {
Layout.margins: 5

RowLayout {
ETextField {
Layout.preferredWidth: 300
}

EText {
Layout.leftMargin: 5
text: 'Default'
}
}

RowLayout {
ETextField {
Layout.preferredWidth: 300
placeHolderText: 'Hello World'
}

EText {
Layout.leftMargin: 5
text: 'With Placeholder'
}
}

RowLayout {
ETextField {
Layout.preferredWidth: 300
wrapMode: TextInput.Wrap
text: 'This is a very very very very very very very very very long words.'
}

EText {
Layout.leftMargin: 5
text: 'Wrap'
}
}

RowLayout {
ETextField {
Layout.fillWidth: true
placeHolderText: 'Block Input'
}
}
}
}
}
}