T_Carousel.qml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Window
  4. import QtQuick.Controls
  5. import FluentUI
  6. import "../component"
  7. FluScrollablePage{
  8. title:"Carousel"
  9. leftPadding:10
  10. rightPadding:10
  11. bottomPadding:20
  12. spacing: 0
  13. FluArea{
  14. Layout.fillWidth: true
  15. height: 370
  16. paddings: 10
  17. Layout.topMargin: 20
  18. Column{
  19. spacing: 15
  20. anchors{
  21. verticalCenter: parent.verticalCenter
  22. left:parent.left
  23. }
  24. FluText{
  25. text:"轮播图,支持无限轮播,无限滑动,用ListView实现的组件"
  26. }
  27. FluCarousel{
  28. id:carousel
  29. Layout.topMargin: 20
  30. Layout.leftMargin: 5
  31. Component.onCompleted: {
  32. carousel.setData([{url:"qrc:/example/res/image/banner_1.jpg"},{url:"qrc:/example/res/image/banner_2.jpg"},{url:"qrc:/example/res/image/banner_3.jpg"}])
  33. }
  34. }
  35. }
  36. }
  37. CodeExpander{
  38. Layout.fillWidth: true
  39. Layout.topMargin: -1
  40. code:'FluCarousel{
  41. width: 400
  42. height: 300
  43. Component.onCompleted: {
  44. setData([{url:"qrc:/example/res/image/banner_1.jpg"},{url:"qrc:/example/res/image/banner_2.jpg"},{url:"qrc:/example/res/image/banner_3.jpg"}])
  45. }
  46. }'
  47. }
  48. }