From 1a6c53d0ce860f84be6af6f0cffceb037e884e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Mon, 18 Mar 2024 22:26:22 +0800 Subject: [PATCH] update --- example/qml/page/T_ComboBox.qml | 28 +++++++++++++++++-- .../imports/FluentUI/Controls/FluComboBox.qml | 9 ++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/example/qml/page/T_ComboBox.qml b/example/qml/page/T_ComboBox.qml index d546672b..822c60f1 100644 --- a/example/qml/page/T_ComboBox.qml +++ b/example/qml/page/T_ComboBox.qml @@ -32,6 +32,30 @@ FluScrollablePage{ } } + FluArea { + Layout.fillWidth: true + height: 80 + paddings: 5 + Layout.topMargin: 20 + Column{ + spacing: 5 + anchors.verticalCenter: parent.verticalCenter + FluText{ + text: "disabled=true" + x:10 + } + FluComboBox { + disabled: true + model: ListModel { + id: model_2 + ListElement { text: "Banana" } + ListElement { text: "Apple" } + ListElement { text: "Coconut" } + } + } + } + } + FluArea{ Layout.fillWidth: true height: 80 @@ -47,14 +71,14 @@ FluScrollablePage{ FluComboBox { editable: true model: ListModel { - id: model_2 + id: model_3 ListElement { text: "Banana" } ListElement { text: "Apple" } ListElement { text: "Coconut" } } onAccepted: { if (find(editText) === -1) - model_2.append({text: editText}) + model_3.append({text: editText}) } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml index 2323229a..00512421 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluComboBox.qml @@ -52,7 +52,12 @@ T.ComboBox { autoScroll: control.editable font:control.font readOnly: control.down - color: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) + color: { + if(control.disabled) { + return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) + } + return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) + } inputMethodHints: control.inputMethodHints validator: control.validator selectByMouse: true @@ -109,7 +114,7 @@ T.ComboBox { model: control.delegateModel currentIndex: control.highlightedIndex highlightMoveDuration: 0 - boundsMovement: Flickable.StopAtBounds + boundsMovement: Flickable.StopAtBounds T.ScrollIndicator.vertical: ScrollIndicator { } } enter: Transition {