Skip to content

Commit 8fd0106

Browse files
Merge pull request #396 from FlyAndNotDown/master
Feat: Misc Update
2 parents 941c880 + 0b637f8 commit 8fd0106

File tree

3 files changed

+100
-1
lines changed

3 files changed

+100
-1
lines changed

Editor/Qml/EComboBox.qml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import QtQuick
2+
import QtQuick.Controls
3+
import QtQuick.Controls.Basic
4+
5+
ComboBox {
6+
id: root
7+
model: model
8+
9+
implicitWidth: 100
10+
implicitHeight: 30
11+
12+
indicator: Canvas {
13+
id: canvas
14+
x: root.width - width - root.rightPadding
15+
y: root.topPadding + (root.availableHeight - height) / 2
16+
width: 10
17+
height: 6
18+
contextType: "2d"
19+
20+
Connections {
21+
target: root
22+
function onPressedChanged() { canvas.requestPaint(); }
23+
}
24+
25+
onPaint: {
26+
context.reset();
27+
context.moveTo(0, 0);
28+
context.lineTo(width, 0);
29+
context.lineTo(width / 2, height);
30+
context.closePath();
31+
context.fillStyle = ETheme.fontColor
32+
context.fill();
33+
}
34+
}
35+
36+
contentItem: Text {
37+
leftPadding: 10
38+
rightPadding: root.indicator.width + root.spacing
39+
40+
text: root.displayText
41+
font.pixelSize: ETheme.contentFontSize
42+
font.family: ETheme.fontFamily
43+
color: ETheme.fontColor
44+
verticalAlignment: Text.AlignVCenter
45+
elide: Text.ElideRight
46+
}
47+
48+
background: Rectangle {
49+
width: root.width
50+
height: root.height
51+
radius: 5
52+
color: ETheme.primaryBgColor
53+
}
54+
55+
popup: Popup {
56+
y: root.height - 1
57+
width: root.width
58+
height: Math.min(contentItem.implicitHeight, root.Window.height - topMargin - bottomMargin)
59+
padding: 1
60+
61+
contentItem: ListView {
62+
clip: true
63+
implicitHeight: contentHeight
64+
model: root.popup.visible ? root.delegateModel : null
65+
currentIndex: root.highlightedIndex
66+
67+
ScrollIndicator.vertical: ScrollIndicator { }
68+
}
69+
70+
background: Rectangle {
71+
radius: 5
72+
color: ETheme.primaryBgColor
73+
}
74+
}
75+
}

Editor/Qml/EWidgetSamples.qml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,30 @@ Rectangle {
549549
}
550550
}
551551
}
552+
553+
RowLayout {
554+
Layout.leftMargin: 5
555+
Layout.topMargin: 15
556+
EText {
557+
text: 'ComboBox'
558+
style: EText.Style.Title1
559+
}
560+
}
561+
562+
ColumnLayout {
563+
Layout.margins: 5
564+
565+
RowLayout {
566+
EComboBox {
567+
model: ['a', 'b', 'c']
568+
}
569+
570+
EText {
571+
Layout.leftMargin: 5
572+
text: 'Default'
573+
}
574+
}
575+
}
552576
}
553577
}
554578
}

ThirdParty/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Setup3rdPackage(
257257
VERSION ${QT_VERSION}
258258
HASH
259259
Windows e2a573a53b6de88c0ce768868bd5a8258d432ad71c45a407afa55243b051668f
260-
Darwin 2fadcb1f07e5f11d4345e7d5631f35f8f4a8033c35901fb20a22c2feb7486e57
260+
Darwin b2ac69968f52c5174749e602ce567f4aa429d131921aa11e5577fa46759cf05b
261261
PREFIX
262262
Windows $<SOURCE_DIR>/6.5.2/msvc2019_64
263263
Darwin $<SOURCE_DIR>/6.5.2/macos

0 commit comments

Comments
 (0)