Skip to content

Commit cf42eb2

Browse files
Merge pull request #389 from FlyAndNotDown/master
Feat: Text Field UI Widget
2 parents 110175c + 5fe7ac1 commit cf42eb2

File tree

3 files changed

+92
-2
lines changed

3 files changed

+92
-2
lines changed

Editor/Qml/ETextField.qml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Controls.Basic
4+
5+
Item {
6+
property string placeHolderText: ''
7+
property int wrapMode: TextInput.NoWrap
8+
property string text: ''
9+
10+
id: root
11+
implicitWidth: textField.implicitWidth
12+
implicitHeight: textField.implicitHeight
13+
14+
TextField {
15+
id: textField
16+
width: root.width
17+
height: root.height
18+
implicitWidth: 500
19+
text: root.text
20+
rightPadding: 10
21+
color: ETheme.fontColor
22+
placeholderText: root.placeHolderText
23+
placeholderTextColor: ETheme.placeHolderFontColor
24+
font.pixelSize: ETheme.contentFontSize
25+
font.family: ETheme.fontFamily
26+
wrapMode: root.wrapMode
27+
28+
background: Rectangle {
29+
radius: 5
30+
color: ETheme.primaryBgColor
31+
}
32+
}
33+
}

Editor/Qml/ETheme.qml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ import QtQuick
44

55
QtObject {
66
property color bgColor: Qt.color('#212121')
7-
property color primaryBgColor: Qt.color('#2a2a2a')
7+
property color primaryBgColor: Qt.color('#3a3939')
88
property color primaryColor: Qt.color('#e74c3c')
99
property color primaryHoverColor: Qt.color('#ce4d40')
1010
property color primaryFocusColor: Qt.color('#c0392b')
1111
property color primaryDisabledColor: Qt.color('#4b4a49')
1212
property color secondaryColor: Qt.color('#d58845')
1313
property color secondaryHoverColor: Qt.color('#d58845')
1414
property color secondaryFocusColor: Qt.color('#9b6a40')
15+
property color secondaryBgColor: Qt.color('#8e8e8e')
1516
property color disabledColor: Qt.color('#676563')
1617
property color fontColor: Qt.color('#ecf0f1')
18+
property color placeHolderFontColor: Qt.color('#c0c3c4')
1719
property color linkFontColor: Qt.color('#91b9c4')
18-
property color secondaryBgColor: Qt.color('#8e8e8e')
1920

2021
property FontLoader normalFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Medium.ttf') }
2122
property FontLoader boldFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Semibold.ttf') }

Editor/Qml/EWidgetSamples.qml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,62 @@ Rectangle {
313313
filler: ESwitch.Filler.Text
314314
}
315315
}
316+
317+
RowLayout {
318+
Layout.leftMargin: 5
319+
Layout.topMargin: 15
320+
EText {
321+
text: 'TextInput'
322+
style: EText.Style.Title1
323+
}
324+
}
325+
326+
ColumnLayout {
327+
Layout.margins: 5
328+
329+
RowLayout {
330+
ETextField {
331+
Layout.preferredWidth: 300
332+
}
333+
334+
EText {
335+
Layout.leftMargin: 5
336+
text: 'Default'
337+
}
338+
}
339+
340+
RowLayout {
341+
ETextField {
342+
Layout.preferredWidth: 300
343+
placeHolderText: 'Hello World'
344+
}
345+
346+
EText {
347+
Layout.leftMargin: 5
348+
text: 'With Placeholder'
349+
}
350+
}
351+
352+
RowLayout {
353+
ETextField {
354+
Layout.preferredWidth: 300
355+
wrapMode: TextInput.Wrap
356+
text: 'This is a very very very very very very very very very long words.'
357+
}
358+
359+
EText {
360+
Layout.leftMargin: 5
361+
text: 'Wrap'
362+
}
363+
}
364+
365+
RowLayout {
366+
ETextField {
367+
Layout.fillWidth: true
368+
placeHolderText: 'Block Input'
369+
}
370+
}
371+
}
316372
}
317373
}
318374
}

0 commit comments

Comments
 (0)