2023-08-24 15:50:37 +08:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Window 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import FluentUI 1.0
|
2023-08-26 17:20:30 +08:00
|
|
|
import "../component"
|
2023-05-23 17:37:25 +08:00
|
|
|
|
|
|
|
FluScrollablePage{
|
|
|
|
|
2024-03-09 15:35:48 +08:00
|
|
|
title: qsTr("ComboBox")
|
2023-05-23 17:37:25 +08:00
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame{
|
2023-05-23 17:37:25 +08:00
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 80
|
|
|
|
padding: 5
|
2023-05-23 17:37:25 +08:00
|
|
|
Column{
|
|
|
|
spacing: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
FluText{
|
|
|
|
text: "editable=false"
|
|
|
|
x:10
|
|
|
|
}
|
|
|
|
FluComboBox {
|
|
|
|
model: ListModel {
|
|
|
|
id: model_1
|
|
|
|
ListElement { text: "Banana" }
|
|
|
|
ListElement { text: "Apple" }
|
|
|
|
ListElement { text: "Coconut" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame {
|
2024-03-18 22:26:22 +08:00
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.preferredHeight: 80
|
|
|
|
padding: 5
|
2024-03-18 22:26:22 +08:00
|
|
|
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" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame{
|
2023-05-23 17:37:25 +08:00
|
|
|
Layout.fillWidth: true
|
|
|
|
height: 80
|
2024-03-29 16:23:16 +08:00
|
|
|
padding: 10
|
2023-05-23 17:37:25 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
Column{
|
|
|
|
spacing: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
FluText{
|
|
|
|
text: "editable=true"
|
|
|
|
x:5
|
|
|
|
}
|
|
|
|
FluComboBox {
|
|
|
|
editable: true
|
|
|
|
model: ListModel {
|
2024-03-18 22:26:22 +08:00
|
|
|
id: model_3
|
2023-05-23 17:37:25 +08:00
|
|
|
ListElement { text: "Banana" }
|
|
|
|
ListElement { text: "Apple" }
|
|
|
|
ListElement { text: "Coconut" }
|
|
|
|
}
|
|
|
|
onAccepted: {
|
|
|
|
if (find(editText) === -1)
|
2024-03-18 22:26:22 +08:00
|
|
|
model_3.append({text: editText})
|
2023-05-23 17:37:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2023-05-23 17:37:25 +08:00
|
|
|
code:'FluComboBox{
|
|
|
|
editable: true
|
|
|
|
model: ListModel {
|
|
|
|
id: model
|
|
|
|
ListElement { text: "Banana" }
|
|
|
|
ListElement { text: "Apple" }
|
|
|
|
ListElement { text: "Coconut" }
|
|
|
|
}
|
|
|
|
onAccepted: {
|
|
|
|
if (find(editText) === -1)
|
|
|
|
model.append({text: editText})
|
|
|
|
}
|
|
|
|
}'
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|