MauiKit Calendar

MonthsGrid.qml
1import QtQuick
2import QtQuick.Layouts
3import QtQuick.Controls
4
5import org.mauikit.controls 1.3 as Maui
6import org.mauikit.calendar 1.0 as Kalendar
7
8/**
9 * @inherit QtQuick.Controls.Page
10 * @brief A control for visualizing the months of the year.
11 *
12 * @image html monthsgrid.png
13 *
14 * @code
15 * MC.MonthsGrid
16 * {
17 * id: _view
18 * anchors.centerIn: parent
19 * selectedMonth: 5
20 * }
21 * @endcode
22 */
23Page
24{
25 id: control
26 background: null
27 padding: Maui.Style.defaultPadding
28
29 /**
30 * @brief
31 */
32 property int selectedMonth
33
34 /**
35 * @brief
36 */
37 property alias columns : monthsGrid.columns
38
39 /**
40 * @brief
41 * @param month
42 */
43 signal monthSelected(var month)
44
45 contentItem: GridLayout
46 {
47 id: monthsGrid
48 columns: 3
49
50 ButtonGroup
51 {
52 buttons: monthsGrid.children
53 }
54
55 Repeater
56 {
57 model: 12
58
59 delegate: Button
60 {
61 Layout.fillWidth: true
62 text: Qt.locale().standaloneMonthName(index)
63
64 checkable: true
65 checked: control.selectedMonth === index
66
67 onClicked:
68 {
69 control.monthSelected(index)
70 }
71
72 background: Rectangle
73 {
74 visible: checked
75 color: checked ? Maui.Theme.highlightColor : hovered ? Maui.Theme.hoverColor : "transparent"
76 radius: Maui.Style.radiusV
77 }
78 }
79 }
80 }
81}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:50:32 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.