FluentUI/example/qml/page/T_Awesome.qml

72 lines
1.9 KiB
QML
Raw Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import FluentUI 1.0
2023-03-02 12:20:16 +08:00
2023-03-10 18:08:32 +08:00
FluContentPage {
2024-03-09 15:35:48 +08:00
title: qsTr("Awesome")
2023-03-10 18:08:32 +08:00
2023-03-02 12:20:16 +08:00
FluTextBox{
id:text_box
2024-03-09 15:35:48 +08:00
placeholderText: qsTr("Please enter a keyword")
2023-03-02 12:20:16 +08:00
anchors{
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{
2024-03-09 15:35:48 +08:00
text: qsTr("Search")
2023-03-02 18:21:43 +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-03-02 18:21:43 +08:00
}
}
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
2023-07-11 10:46:57 +08:00
boundsBehavior: GridView.StopAtBounds
2023-09-27 15:18:10 +08:00
model:FluTheme.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;
2023-04-27 17:29:39 +08:00
FluTools.clipText(text)
2024-03-09 15:35:48 +08:00
showSuccess(qsTr("You Copied ")+text)
2023-03-02 12:20:16 +08:00
}
}
FluText {
id:item_name
2023-03-11 00:29:06 +08:00
font.pixelSize: 10
2024-04-04 01:10:14 +08:00
font.family: FluTextStyle.family
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
2024-03-09 22:19:10 +08:00
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
}
}
}
}