T_Awesome.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. import QtQuick.Window
  5. import FluentUI
  6. FluContentPage {
  7. title:"Awesome"
  8. leftPadding:10
  9. rightPadding:10
  10. bottomPadding:20
  11. FluTextBox{
  12. id:text_box
  13. placeholderText: "请输入关键字"
  14. anchors{
  15. topMargin: 20
  16. top:parent.top
  17. }
  18. }
  19. FluFilledButton{
  20. text:"搜索"
  21. anchors{
  22. left: text_box.right
  23. verticalCenter: text_box.verticalCenter
  24. leftMargin: 14
  25. }
  26. onClicked: {
  27. grid_view.model = FluApp.awesomelist(text_box.text)
  28. }
  29. }
  30. GridView{
  31. id:grid_view
  32. cellWidth: 80
  33. cellHeight: 80
  34. clip: true
  35. model:FluApp.awesomelist()
  36. ScrollBar.vertical: FluScrollBar {}
  37. anchors{
  38. topMargin: 10
  39. top:text_box.bottom
  40. left: parent.left
  41. right: parent.right
  42. bottom: parent.bottom
  43. }
  44. delegate: Item {
  45. width: 68
  46. height: 80
  47. FluIconButton{
  48. id:item_icon
  49. iconSource:modelData.icon
  50. anchors.horizontalCenter: parent.horizontalCenter
  51. onClicked: {
  52. var text ="FluentIcons."+modelData.name;
  53. FluTools.clipText(text)
  54. showSuccess("您复制了 "+text)
  55. }
  56. }
  57. FluText {
  58. id:item_name
  59. font.pixelSize: 10
  60. anchors.horizontalCenter: parent.horizontalCenter
  61. anchors.top: item_icon.bottom
  62. width:parent.width
  63. wrapMode: Text.WrapAnywhere
  64. text: modelData.name
  65. horizontalAlignment: Text.AlignHCenter
  66. }
  67. }
  68. }
  69. }