mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-10-31 16:17:29 +08:00
192 lines
4.6 KiB
QML
192 lines
4.6 KiB
QML
|
import QtQuick
|
||
|
import QtQuick.Controls
|
||
|
import QtQuick.Layouts
|
||
|
import QtQuick.Window
|
||
|
import FluentUI
|
||
|
import "qrc:///example/qml/component"
|
||
|
|
||
|
FluScrollablePage{
|
||
|
|
||
|
launchMode: FluPageType.SingleInstance
|
||
|
|
||
|
title:"TextBox"
|
||
|
FluArea{
|
||
|
Layout.fillWidth: true
|
||
|
height: 68
|
||
|
paddings: 10
|
||
|
Layout.topMargin: 20
|
||
|
|
||
|
FluTextBox{
|
||
|
placeholderText: "单行输入框"
|
||
|
disabled:text_box_switch.checked
|
||
|
cleanEnabled: true
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
left: parent.left
|
||
|
}
|
||
|
}
|
||
|
|
||
|
FluToggleSwitch{
|
||
|
id:text_box_switch
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
right: parent.right
|
||
|
}
|
||
|
text:"Disabled"
|
||
|
}
|
||
|
}
|
||
|
CodeExpander{
|
||
|
Layout.fillWidth: true
|
||
|
Layout.topMargin: -1
|
||
|
code:'FluTextBox{
|
||
|
placeholderText:"单行输入框"
|
||
|
}'
|
||
|
}
|
||
|
|
||
|
FluArea{
|
||
|
Layout.fillWidth: true
|
||
|
height: 68
|
||
|
paddings: 10
|
||
|
Layout.topMargin: 20
|
||
|
|
||
|
FluPasswordBox{
|
||
|
placeholderText: "请输入密码"
|
||
|
disabled:password_box_switch.checked
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
left: parent.left
|
||
|
}
|
||
|
}
|
||
|
FluToggleSwitch{
|
||
|
id:password_box_switch
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
right: parent.right
|
||
|
}
|
||
|
text:"Disabled"
|
||
|
}
|
||
|
}
|
||
|
CodeExpander{
|
||
|
Layout.fillWidth: true
|
||
|
Layout.topMargin: -1
|
||
|
code:'FluPasswordBox{
|
||
|
placeholderText:"请输入密码"
|
||
|
}'
|
||
|
}
|
||
|
|
||
|
|
||
|
FluArea{
|
||
|
Layout.fillWidth: true
|
||
|
height: 36+multiine_textbox.height
|
||
|
paddings: 10
|
||
|
Layout.topMargin: 20
|
||
|
|
||
|
FluMultilineTextBox{
|
||
|
id:multiine_textbox
|
||
|
placeholderText: "多行输入框"
|
||
|
disabled:text_box_multi_switch.checked
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
left: parent.left
|
||
|
}
|
||
|
}
|
||
|
|
||
|
FluToggleSwitch{
|
||
|
id:text_box_multi_switch
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
right: parent.right
|
||
|
}
|
||
|
text:"Disabled"
|
||
|
}
|
||
|
}
|
||
|
CodeExpander{
|
||
|
Layout.fillWidth: true
|
||
|
Layout.topMargin: -1
|
||
|
code:'FluMultilineTextBox{
|
||
|
placeholderText:"多行输入框"
|
||
|
}'
|
||
|
}
|
||
|
|
||
|
FluArea{
|
||
|
Layout.fillWidth: true
|
||
|
height: 68
|
||
|
paddings: 10
|
||
|
Layout.topMargin: 20
|
||
|
FluAutoSuggestBox{
|
||
|
placeholderText: "AutoSuggestBox"
|
||
|
items:generateRandomNames(100)
|
||
|
disabled:text_box_suggest_switch.checked
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
left: parent.left
|
||
|
}
|
||
|
}
|
||
|
FluToggleSwitch{
|
||
|
id:text_box_suggest_switch
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
right: parent.right
|
||
|
}
|
||
|
text:"Disabled"
|
||
|
}
|
||
|
}
|
||
|
CodeExpander{
|
||
|
Layout.fillWidth: true
|
||
|
Layout.topMargin: -1
|
||
|
code:'FluAutoSuggestBox{
|
||
|
placeholderText:"AutoSuggestBox"
|
||
|
}'
|
||
|
}
|
||
|
|
||
|
FluArea{
|
||
|
Layout.fillWidth: true
|
||
|
height: 68
|
||
|
paddings: 10
|
||
|
Layout.topMargin: 20
|
||
|
FluSpinBox{
|
||
|
disabled: spin_box_switch.checked
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
left: parent.left
|
||
|
}
|
||
|
}
|
||
|
FluToggleSwitch{
|
||
|
id:spin_box_switch
|
||
|
anchors{
|
||
|
verticalCenter: parent.verticalCenter
|
||
|
right: parent.right
|
||
|
}
|
||
|
text:"Disabled"
|
||
|
}
|
||
|
}
|
||
|
CodeExpander{
|
||
|
Layout.fillWidth: true
|
||
|
Layout.topMargin: -1
|
||
|
code:'FluSpinBox{
|
||
|
|
||
|
}'
|
||
|
}
|
||
|
|
||
|
function generateRandomNames(numNames) {
|
||
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||
|
const names = [];
|
||
|
function generateRandomName() {
|
||
|
const nameLength = Math.floor(Math.random() * 5) + 4;
|
||
|
let name = '';
|
||
|
for (let i = 0; i < nameLength; i++) {
|
||
|
const letterIndex = Math.floor(Math.random() * 26);
|
||
|
name += alphabet.charAt(letterIndex);
|
||
|
}
|
||
|
return name;
|
||
|
}
|
||
|
for (let i = 0; i < numNames; i++) {
|
||
|
const name = generateRandomName();
|
||
|
names.push({title:name});
|
||
|
}
|
||
|
return names;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|