Warning, /maui/mauikit-calendar/src/controls.6/YearsGrid.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 0002 import QtQuick.Layouts 0003 import QtQuick.Controls 0004 0005 import org.mauikit.controls 1.3 as Maui 0006 import org.mauikit.calendar 1.0 as Kalendar 0007 0008 /** 0009 * @inherit QtQuick.Controls.Page 0010 * @brief A view for browsing calendar years. 0011 * 0012 * @image html yearsgrid.png "Years view control" 0013 * 0014 * @code 0015 * YearsGrid 0016 * { 0017 * anchors.fill: parent 0018 * 0019 * from: 2010 0020 * to: 2029 0021 * } 0022 * @endcode 0023 */ 0024 Page 0025 { 0026 id: control 0027 0028 background: null 0029 padding: Maui.Style.defaultPadding 0030 0031 /** 0032 * @brief 0033 */ 0034 property int from : 1999 0035 0036 /** 0037 * @brief 0038 */ 0039 property int to : 2100 0040 0041 /** 0042 * @brief 0043 */ 0044 property int selectedYear : 0045 { 0046 var date = new Date() 0047 return date.getFullYear() 0048 } 0049 0050 /** 0051 * @brief 0052 */ 0053 property alias columns : _yearsGrid.columns 0054 0055 /** 0056 * @brief 0057 * @param year 0058 */ 0059 signal yearSelected(var year) 0060 0061 contentItem: ScrollView 0062 { 0063 Flickable 0064 { 0065 contentHeight: _yearsGrid.implicitHeight 0066 contentWidth: availableWidth 0067 0068 GridLayout 0069 { 0070 id: _yearsGrid 0071 0072 anchors.fill: parent 0073 columns: Math.max(3, width/80) 0074 0075 ButtonGroup 0076 { 0077 buttons: _yearsGrid.children 0078 } 0079 0080 Repeater 0081 { 0082 model: control.to - control.from + 1 0083 delegate: Button 0084 { 0085 property int year : control.from + modelData 0086 Layout.fillWidth: true 0087 Layout.maximumWidth: 80 0088 text: year 0089 0090 checkable: true 0091 checked: year === control.selectedYear 0092 onClicked: control.yearSelected(year) 0093 0094 background: Rectangle 0095 { 0096 visible: checked 0097 color: checked ? Maui.Theme.highlightColor : hovered ? Maui.Theme.hoverColor : "transparent" 0098 radius: Maui.Style.radiusV 0099 } 0100 } 0101 } 0102 } 0103 } 0104 } 0105 }