FluentUI/example/qml/page/T_Awesome.qml

75 lines
1.8 KiB
QML
Raw Normal View History

2023-03-30 21:52:55 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import FluentUI
2023-03-02 12:20:16 +08:00
2023-03-10 18:08:32 +08:00
FluContentPage {
title:"Awesome"
2023-03-28 17:53:46 +08:00
leftPadding:10
rightPadding:10
bottomPadding:20
2023-03-02 12:20:16 +08:00
FluTextBox{
id:text_box
2023-03-02 18:21:43 +08:00
placeholderText: "请输入关键字"
2023-03-02 12:20:16 +08:00
anchors{
topMargin: 20
2023-03-10 18:08:32 +08:00
top:parent.top
2023-03-02 12:20:16 +08:00
}
}
2023-03-10 18:08:32 +08:00
2023-03-02 18:21:43 +08:00
FluFilledButton{
text:"搜索"
anchors{
left: text_box.right
verticalCenter: text_box.verticalCenter
leftMargin: 14
}
onClicked: {
grid_view.model = FluApp.awesomelist(text_box.text)
}
}
2023-03-02 12:20:16 +08:00
GridView{
2023-03-02 18:21:43 +08:00
id:grid_view
2023-03-11 00:29:06 +08:00
cellWidth: 80
cellHeight: 80
2023-03-02 12:20:16 +08:00
clip: true
model:FluApp.awesomelist()
2023-03-02 18:21:43 +08:00
ScrollBar.vertical: FluScrollBar {}
2023-03-02 12:20:16 +08:00
anchors{
topMargin: 10
top:text_box.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
delegate: Item {
2023-03-11 00:29:06 +08:00
width: 68
height: 80
2023-03-02 12:20:16 +08:00
FluIconButton{
id:item_icon
2023-03-12 21:49:11 +08:00
iconSource:modelData.icon
2023-03-02 12:20:16 +08:00
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
var text ="FluentIcons."+modelData.name;
FluApp.clipText(text)
showSuccess("您复制了 "+text)
}
}
FluText {
id:item_name
2023-03-11 00:29:06 +08:00
font.pixelSize: 10
2023-03-02 12:20:16 +08:00
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: item_icon.bottom
2023-03-11 00:29:06 +08:00
width:parent.width
wrapMode: Text.WrapAnywhere
2023-03-02 12:20:16 +08:00
text: modelData.name
2023-03-11 00:29:06 +08:00
horizontalAlignment: Text.AlignHCenter
2023-03-02 12:20:16 +08:00
}
}
}
}