Warning, /maui/mauikit-calendar/src/controls.6/MonthsGrid.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 control for visualizing the months of the year.
0011  * 
0012  * @image html monthsgrid.png
0013  * 
0014  * @code 
0015  * MC.MonthsGrid
0016  * {
0017  *    id: _view
0018  *    anchors.centerIn: parent
0019  *    selectedMonth: 5
0020  * }
0021  * @endcode
0022  */
0023 Page
0024 {
0025     id:  control
0026     background: null
0027     padding: Maui.Style.defaultPadding
0028     
0029     /**
0030      * @brief
0031      */
0032     property int selectedMonth
0033     
0034     /**
0035      * @brief
0036      */
0037     property alias columns : monthsGrid.columns
0038     
0039     /**
0040      * @brief
0041      * @param month
0042      */
0043     signal monthSelected(var month)
0044     
0045     contentItem: GridLayout
0046     {
0047         id: monthsGrid
0048         columns: 3
0049         
0050         ButtonGroup 
0051         {
0052             buttons: monthsGrid.children
0053         }        
0054         
0055         Repeater
0056         {
0057             model: 12            
0058             
0059             delegate: Button
0060             {
0061                 Layout.fillWidth: true
0062                 text: Qt.locale().standaloneMonthName(index)
0063                 
0064                 checkable: true
0065                 checked: control.selectedMonth === index     
0066                 
0067                 onClicked: 
0068                 {
0069                     control.monthSelected(index)
0070                 }
0071                 
0072                 background: Rectangle
0073                 {
0074                     visible: checked
0075                     color: checked ? Maui.Theme.highlightColor : hovered ? Maui.Theme.hoverColor : "transparent"
0076                     radius: Maui.Style.radiusV
0077                 }
0078             }
0079         }
0080     }
0081 }