diff --git a/Editor/Qml/EComboBox.qml b/Editor/Qml/EComboBox.qml new file mode 100644 index 000000000..a92ced1ce --- /dev/null +++ b/Editor/Qml/EComboBox.qml @@ -0,0 +1,75 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Basic + +ComboBox { + id: root + model: model + + implicitWidth: 100 + implicitHeight: 30 + + indicator: Canvas { + id: canvas + x: root.width - width - root.rightPadding + y: root.topPadding + (root.availableHeight - height) / 2 + width: 10 + height: 6 + contextType: "2d" + + Connections { + target: root + function onPressedChanged() { canvas.requestPaint(); } + } + + onPaint: { + context.reset(); + context.moveTo(0, 0); + context.lineTo(width, 0); + context.lineTo(width / 2, height); + context.closePath(); + context.fillStyle = ETheme.fontColor + context.fill(); + } + } + + contentItem: Text { + leftPadding: 10 + rightPadding: root.indicator.width + root.spacing + + text: root.displayText + font.pixelSize: ETheme.contentFontSize + font.family: ETheme.fontFamily + color: ETheme.fontColor + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + width: root.width + height: root.height + radius: 5 + color: ETheme.primaryBgColor + } + + popup: Popup { + y: root.height - 1 + width: root.width + height: Math.min(contentItem.implicitHeight, root.Window.height - topMargin - bottomMargin) + padding: 1 + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: root.popup.visible ? root.delegateModel : null + currentIndex: root.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + radius: 5 + color: ETheme.primaryBgColor + } + } +} diff --git a/Editor/Qml/EWidgetSamples.qml b/Editor/Qml/EWidgetSamples.qml index aa5001cfb..9960624ff 100644 --- a/Editor/Qml/EWidgetSamples.qml +++ b/Editor/Qml/EWidgetSamples.qml @@ -549,6 +549,30 @@ Rectangle { } } } + + RowLayout { + Layout.leftMargin: 5 + Layout.topMargin: 15 + EText { + text: 'ComboBox' + style: EText.Style.Title1 + } + } + + ColumnLayout { + Layout.margins: 5 + + RowLayout { + EComboBox { + model: ['a', 'b', 'c'] + } + + EText { + Layout.leftMargin: 5 + text: 'Default' + } + } + } } } } diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index b53e589c6..4ff3e243f 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -257,7 +257,7 @@ Setup3rdPackage( VERSION ${QT_VERSION} HASH Windows e2a573a53b6de88c0ce768868bd5a8258d432ad71c45a407afa55243b051668f - Darwin 2fadcb1f07e5f11d4345e7d5631f35f8f4a8033c35901fb20a22c2feb7486e57 + Darwin b2ac69968f52c5174749e602ce567f4aa429d131921aa11e5577fa46759cf05b PREFIX Windows $/6.5.2/msvc2019_64 Darwin $/6.5.2/macos