FluentUI/example/qml/page/T_Icons.qml

65 lines
1.7 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-04-11 19:18:37 +08:00
title: qsTr("Icons")
2023-03-10 18:08:32 +08:00
2023-03-02 12:20:16 +08:00
FluTextBox{
2024-04-11 19:18:37 +08:00
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{
2024-04-11 19:18:37 +08:00
top: parent.top
2023-03-02 12:20:16 +08:00
}
2024-04-28 21:05:43 +08:00
onTextChanged: {
grid_view.model = FluApp.iconData(text_box.text)
2023-03-02 18:21:43 +08:00
}
}
2023-03-02 12:20:16 +08:00
GridView{
2024-04-11 19:18:37 +08:00
id: grid_view
cellWidth: 110
cellHeight: 110
2023-03-02 12:20:16 +08:00
clip: true
2023-07-11 10:46:57 +08:00
boundsBehavior: GridView.StopAtBounds
2024-04-28 21:05:43 +08:00
model: FluApp.iconData()
2023-03-02 18:21:43 +08:00
ScrollBar.vertical: FluScrollBar {}
2023-03-02 12:20:16 +08:00
anchors{
topMargin: 10
2024-04-11 19:18:37 +08:00
top: text_box.bottom
2023-03-02 12:20:16 +08:00
left: parent.left
right: parent.right
bottom: parent.bottom
}
delegate: Item {
2024-04-11 19:18:37 +08:00
width: 100
height: 100
2023-03-02 12:20:16 +08:00
FluIconButton{
id:item_icon
2024-04-11 19:18:37 +08:00
iconSource: modelData.icon
iconSize: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
bottomPadding: 30
anchors.fill: parent
2023-03-02 12:20:16 +08:00
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
}
2024-04-11 19:18:37 +08:00
FluText{
width: parent.width
horizontalAlignment: Qt.AlignHCenter
wrapMode: Text.WrapAnywhere
text: modelData.name
anchors.top: parent.top
anchors.topMargin: 60
}
2023-03-02 12:20:16 +08:00
}
}
}
}