Skip to content

Commit 110175c

Browse files
Merge pull request #388 from FlyAndNotDown/master
Feat: Editor UI Update
2 parents 2368bff + ccba65e commit 110175c

17 files changed

+168
-44
lines changed

Editor/Include/Editor/Widget/Editor.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Created by Kindem on 2025/3/22.
3+
//
4+
5+
#pragma once
6+
7+
#include <QWidget>
8+
9+
namespace Editor {
10+
class Editor final : public QWidget {
11+
Q_OBJECT
12+
13+
public:
14+
Editor();
15+
};
16+
}

Editor/Qml/EProjectHub.qml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
11
import QtQuick
2+
import QtQuick.Layouts
23

34
Rectangle {
4-
color: ETheme.bgColor
5+
RowLayout {
6+
anchors.fill: parent
7+
spacing: 0
8+
9+
ColumnLayout {
10+
Layout.preferredWidth: 5
11+
Layout.fillWidth: true
12+
Layout.fillHeight: true
13+
14+
Rectangle {
15+
Layout.fillWidth: true
16+
Layout.fillHeight: true
17+
color: ETheme.primaryBgColor
18+
19+
ColumnLayout {
20+
id: menuCol
21+
anchors.fill: parent
22+
anchors.margins: 20
23+
24+
RowLayout {
25+
Layout.preferredHeight: 1
26+
Layout.fillHeight: true
27+
Layout.fillWidth: true
28+
29+
Image {
30+
source: Qt.url('Resource/Image/Logo.png')
31+
sourceSize.width: menuCol.width
32+
}
33+
}
34+
35+
RowLayout {
36+
Layout.preferredHeight: 7
37+
Layout.fillHeight: true
38+
Layout.fillWidth: true
39+
}
40+
}
41+
}
42+
}
43+
44+
ColumnLayout {
45+
Layout.preferredWidth: 14
46+
Layout.fillWidth: true
47+
Layout.fillHeight: true
48+
49+
Rectangle {
50+
Layout.fillWidth: true
51+
Layout.fillHeight: true
52+
color: ETheme.bgColor
53+
}
54+
}
55+
}
556
}

Editor/Qml/ESwitch.qml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import QtQuick
22
import QtQuick.Controls
33
import QtQuick.Controls.Basic
44

5-
65
Item {
7-
86
enum Size {
97
Small,
108
Middle,
@@ -13,7 +11,7 @@ Item {
1311

1412
enum Filler {
1513
None,
16-
Withchar
14+
Text
1715
}
1816

1917
property string text: ''
@@ -38,33 +36,32 @@ Item {
3836
indicator: Rectangle {
3937
function getBackgroundColor(checked, disabled) {
4038
if (disabled) {
41-
return checked ? ETheme.disabledCheckedColor : ETheme.disabledColor;
39+
return checked ? ETheme.primaryDisabledColor : ETheme.disabledColor;
4240
}
4341
return checked ? ETheme.primaryColor : ETheme.secondaryBgColor;
4442
}
4543

46-
implicitWidth: 40 + 2 * (root.size - 1)
44+
implicitWidth: 45 + 2 * (root.size - 1)
4745
implicitHeight: 24 + 2 * (root.size - 1)
4846
x: switchWidget.leftPadding
4947
anchors.verticalCenter: parent.verticalCenter
50-
radius: width / 2
48+
radius: width / 4
5149
color: getBackgroundColor(switchWidget.checked, root.disabled)
5250

5351
Rectangle {
5452
function getX(check, down) {
5553
if (check && down)
56-
return parent.width - 2 * radius - 8;
54+
return parent.width - 4 * radius - 8;
5755
else
58-
return check ? parent.width - width - 2 : 2
59-
56+
return check ? parent.width - width - 4 : 4
6057
}
6158

6259
id: handle
6360
x: getX(switchWidget.checked, switchWidget.down)
6461
anchors.verticalCenter: parent.verticalCenter
65-
radius: switchWidget.checked ? 9 + root.size : 7 + root.size
62+
radius: 7 + root.size
6663
height: 2 * radius
67-
width: switchWidget.down ? 2 * radius + 6 : 2 * radius
64+
width: 2 * radius
6865
color: ETheme.fontColor;
6966

7067
Behavior on width {
@@ -75,17 +72,16 @@ Item {
7572
Behavior on x {
7673
NumberAnimation {
7774
duration: 100
78-
easing.type: easing.InOutCubic
7975
}
8076
}
8177
}
8278

8379
Text {
84-
function getChar(filler, checked, down) {
85-
if (filler == ESwitch.Filler.None || down) {
80+
function getText(filler, checked, down) {
81+
if (filler === ESwitch.Filler.None || down) {
8682
return '';
8783
} else {
88-
return checked ? "" : "";
84+
return checked ? "Y" : "N";
8985
}
9086
}
9187

@@ -95,11 +91,10 @@ Item {
9591
color: ETheme.fontColor
9692
x: switchWidget.checked ? (parent.width - handle.radius * 2 - font.pixelSize - 2) / 2 : (parent.width + handle.radius * 2 - font.pixelSize + 2) / 2;
9793
anchors.verticalCenter: parent.verticalCenter
98-
text: getChar(root.filler, switchWidget.checked, switchWidget.down)
94+
text: getText(root.filler, switchWidget.checked, switchWidget.down)
9995
Behavior on x {
10096
NumberAnimation {
10197
duration: 100
102-
easing.type: easing.OutExpo
10398
}
10499
}
105100
}

Editor/Qml/ETheme.qml

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

55
QtObject {
66
property color bgColor: Qt.color('#212121')
7+
property color primaryBgColor: Qt.color('#2a2a2a')
78
property color primaryColor: Qt.color('#e74c3c')
89
property color primaryHoverColor: Qt.color('#ce4d40')
910
property color primaryFocusColor: Qt.color('#c0392b')
11+
property color primaryDisabledColor: Qt.color('#4b4a49')
1012
property color secondaryColor: Qt.color('#d58845')
1113
property color secondaryHoverColor: Qt.color('#d58845')
1214
property color secondaryFocusColor: Qt.color('#9b6a40')
1315
property color disabledColor: Qt.color('#676563')
1416
property color fontColor: Qt.color('#ecf0f1')
1517
property color linkFontColor: Qt.color('#91b9c4')
1618
property color secondaryBgColor: Qt.color('#8e8e8e')
17-
property color disabledCheckedColor: Qt.color('#c9a9a6')
1819

19-
property FontLoader normalFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Normal.ttf') }
20-
property FontLoader boldFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Bold.ttf') }
20+
property FontLoader normalFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Medium.ttf') }
21+
property FontLoader boldFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Semibold.ttf') }
2122
property int tiele1FontSize: 20
2223
property int title2FontSize: 18
2324
property int title3FontSize: 16

Editor/Qml/EWidgetSamples.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ Rectangle {
281281
style: EText.Style.Title1
282282
}
283283
}
284+
284285
RowLayout {
285286
ESwitch {
286287
text: 'Small Switch'
@@ -295,6 +296,7 @@ Rectangle {
295296
size: ESwitch.Size.Large
296297
}
297298
}
299+
298300
RowLayout {
299301
ESwitch {
300302
text: 'Disabled Checked'
@@ -308,7 +310,7 @@ Rectangle {
308310
}
309311
ESwitch {
310312
text: 'Filled Symbol'
311-
filler: ESwitch.Filler.Withchar
313+
filler: ESwitch.Filler.Text
312314
}
313315
}
314316
}
7.64 MB
Binary file not shown.
7.8 MB
Binary file not shown.
7.57 MB
Binary file not shown.
7.75 MB
Binary file not shown.
7.68 MB
Binary file not shown.

0 commit comments

Comments
 (0)