This commit is contained in:
朱子楚\zhuzi 2023-09-23 15:55:29 +08:00
parent f88b330f8e
commit 7a1776407f
6 changed files with 26 additions and 26 deletions

View File

@ -46,7 +46,6 @@ FluScrollablePage{
} }
FluComboBox { FluComboBox {
editable: true editable: true
font:FluTextStyle.BodyStrong
model: ListModel { model: ListModel {
id: model_2 id: model_2
ListElement { text: "Banana" } ListElement { text: "Banana" }

View File

@ -47,7 +47,6 @@ FluScrollablePage{
} }
FluComboBox { FluComboBox {
editable: true editable: true
font:FluTextStyle.BodyStrong
model: ListModel { model: ListModel {
id: model_2 id: model_2
ListElement { text: "Banana" } ListElement { text: "Banana" }

View File

@ -4,7 +4,7 @@ import QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
import QtQuick.Templates 2.15 as T import QtQuick.Templates 2.15 as T
ComboBox { T.ComboBox {
id: control id: control
signal commit(string text) signal commit(string text)
property bool disabled: false property bool disabled: false
@ -72,6 +72,7 @@ ComboBox {
Keys.onReturnPressed:(event)=> handleCommit(event) Keys.onReturnPressed:(event)=> handleCommit(event)
function handleCommit(event){ function handleCommit(event){
control.commit(control.editText) control.commit(control.editText)
accepted()
} }
} }

View File

@ -4,28 +4,28 @@ import FluentUI 1.0
T.ItemDelegate { T.ItemDelegate {
id: control id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding) implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding, implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding) implicitIndicatorHeight + topPadding + bottomPadding)
padding: 0
padding: 12 verticalPadding: 8
spacing: 8 horizontalPadding: 10
icon.width: 24
icon.height: 24
icon.color: control.palette.text icon.color: control.palette.text
contentItem:FluText {
contentItem: FluText {
text: control.text text: control.text
font: control.font font: control.font
color:{
if(control.down){
return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120
}
return FluTheme.dark ? FluColors.White : FluColors.Grey220
}
} }
background: Rectangle { background: Rectangle {
implicitWidth: 100 implicitWidth: 100
implicitHeight: 40 implicitHeight: 30
color:{ color:{
if(FluTheme.dark){ if(FluTheme.dark){
return Qt.rgba(1,1,1,0.05) return Qt.rgba(1,1,1,0.05)

View File

@ -4,7 +4,7 @@ import QtQuick.Controls.Basic
import FluentUI import FluentUI
import QtQuick.Templates as T import QtQuick.Templates as T
ComboBox { T.ComboBox {
id: control id: control
signal commit(string text) signal commit(string text)
property bool disabled: false property bool disabled: false
@ -72,6 +72,7 @@ ComboBox {
Keys.onReturnPressed:(event)=> handleCommit(event) Keys.onReturnPressed:(event)=> handleCommit(event)
function handleCommit(event){ function handleCommit(event){
control.commit(control.editText) control.commit(control.editText)
accepted()
} }
} }

View File

@ -5,28 +5,28 @@ import FluentUI
T.ItemDelegate { T.ItemDelegate {
id: control id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding) implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding, implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding) implicitIndicatorHeight + topPadding + bottomPadding)
padding: 0
padding: 12 verticalPadding: 8
spacing: 8 horizontalPadding: 10
icon.width: 24
icon.height: 24
icon.color: control.palette.text icon.color: control.palette.text
contentItem:FluText {
contentItem: FluText {
text: control.text text: control.text
font: control.font font: control.font
color:{
if(control.down){
return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120
}
return FluTheme.dark ? FluColors.White : FluColors.Grey220
}
} }
background: Rectangle { background: Rectangle {
implicitWidth: 100 implicitWidth: 100
implicitHeight: 40 implicitHeight: 30
color:{ color:{
if(FluTheme.dark){ if(FluTheme.dark){
return Qt.rgba(1,1,1,0.05) return Qt.rgba(1,1,1,0.05)