aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/basic/MonthGrid.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/basic/MonthGrid.qml')
-rw-r--r--src/quickcontrols/basic/MonthGrid.qml42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/quickcontrols/basic/MonthGrid.qml b/src/quickcontrols/basic/MonthGrid.qml
new file mode 100644
index 0000000000..b8d2379bcf
--- /dev/null
+++ b/src/quickcontrols/basic/MonthGrid.qml
@@ -0,0 +1,42 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Templates as T
+
+T.AbstractMonthGrid {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ spacing: 6
+
+ //! [delegate]
+ delegate: Text {
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ opacity: model.month === control.month ? 1 : 0
+ text: model.day
+ font: control.font
+
+ required property var model
+ }
+ //! [delegate]
+
+ //! [contentItem]
+ contentItem: Grid {
+ rows: 6
+ columns: 7
+ rowSpacing: control.spacing
+ columnSpacing: control.spacing
+
+ Repeater {
+ model: control.source
+ delegate: control.delegate
+ }
+ }
+ //! [contentItem]
+}