Warning, /maui/mauikit-calendar/src/controls.5/YearsGrid.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.4
0002 import QtQuick.Layouts 1.1
0003 import QtQuick.Controls 2.15
0004 
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.calendar 1.0 as Kalendar
0007 
0008 
0009 Page
0010 {
0011     id:  control
0012     background: null
0013     padding: Maui.Style.defaultPadding
0014     
0015     property int from : 1999
0016     property int to : 2100
0017     
0018     property int selectedYear : to
0019     
0020     signal yearSelected(var year)
0021     
0022     contentItem: ScrollView
0023     {
0024         Flickable
0025         {
0026             contentHeight: _yearsGrid.implicitHeight
0027             contentWidth: availableWidth
0028             
0029             GridLayout
0030             {
0031                 anchors.fill: parent
0032                 id: _yearsGrid
0033                 columns: 3
0034                 
0035                 ButtonGroup 
0036                 {
0037                     buttons: _yearsGrid.children
0038                 }
0039                 
0040                 Repeater
0041                 {
0042                     model: control.to - control.from
0043                     delegate: Button
0044                     {
0045                         property int year :  control.from + modelData
0046                         Layout.fillWidth: true
0047                         
0048                         text: year
0049                         
0050                         checkable: true
0051                         checked: year === control.selectedYear
0052                         onClicked: control.yearSelected(year) 
0053                         
0054                         background: Rectangle
0055                         {
0056                             visible: checked
0057                             color: checked ? Maui.Theme.highlightColor : hovered ? Maui.Theme.hoverColor : "transparent"
0058                             radius: Maui.Style.radiusV
0059                         }
0060                     }
0061                 }
0062             }
0063         }
0064     }
0065 }