FluentUI/example/qml-Qt6/page/T_Awesome.qml

72 lines
1.8 KiB
QML
Raw Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import FluentUI
FluContentPage {
2024-03-09 15:35:48 +08:00
title: qsTr("Awesome")
2023-08-24 15:50:37 +08:00
FluTextBox{
id:text_box
2024-03-09 15:35:48 +08:00
placeholderText: qsTr("Please enter a keyword")
2023-08-24 15:50:37 +08:00
anchors{
topMargin: 20
top:parent.top
}
}
FluFilledButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Search")
2023-08-24 15:50:37 +08:00
anchors{
left: text_box.right
verticalCenter: text_box.verticalCenter
leftMargin: 14
}
onClicked: {
2023-09-27 15:18:10 +08:00
grid_view.model = FluTheme.awesomeList(text_box.text)
2023-08-24 15:50:37 +08:00
}
}
GridView{
id:grid_view
cellWidth: 80
cellHeight: 80
clip: true
boundsBehavior: GridView.StopAtBounds
2023-09-27 15:18:10 +08:00
model:FluTheme.awesomeList()
2023-08-24 15:50:37 +08:00
ScrollBar.vertical: FluScrollBar {}
anchors{
topMargin: 10
top:text_box.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
delegate: Item {
width: 68
height: 80
FluIconButton{
id:item_icon
iconSource:modelData.icon
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
var text ="FluentIcons."+modelData.name;
FluTools.clipText(text)
2024-03-09 15:35:48 +08:00
showSuccess(qsTr("You Copied ")+text)
2023-08-24 15:50:37 +08:00
}
}
FluText {
id:item_name
font.pixelSize: 10
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: item_icon.bottom
width:parent.width
2024-03-09 22:19:10 +08:00
wrapMode: Text.WrapAnywhere
2023-08-24 15:50:37 +08:00
text: modelData.name
horizontalAlignment: Text.AlignHCenter
}
}
}
}