MonthGrid.qml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2022 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // Qt-Security score:significant reason:default
  4. import QtQuick
  5. import QtQuick.Templates as T
  6. T.AbstractMonthGrid {
  7. id: control
  8. implicitWidth: Math.max(background ? background.implicitWidth : 0,
  9. contentItem.implicitWidth + leftPadding + rightPadding)
  10. implicitHeight: Math.max(background ? background.implicitHeight : 0,
  11. contentItem.implicitHeight + topPadding + bottomPadding)
  12. spacing: 6
  13. //! [delegate]
  14. delegate: Text {
  15. horizontalAlignment: Text.AlignHCenter
  16. verticalAlignment: Text.AlignVCenter
  17. opacity: model.month === control.month ? 1 : 0
  18. text: model.day
  19. font: control.font
  20. color: control.palette.text
  21. required property var model
  22. }
  23. //! [delegate]
  24. //! [contentItem]
  25. contentItem: Grid {
  26. rows: 6
  27. columns: 7
  28. rowSpacing: control.spacing
  29. columnSpacing: control.spacing
  30. Repeater {
  31. model: control.source
  32. delegate: control.delegate
  33. }
  34. }
  35. //! [contentItem]
  36. }