Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- Window {
- width: 640
- height: 480
- visible: true
- title: qsTr("Hello World")
- property var monthStrings: ["Jan ", "Feb ", "Mar ", "Apr ", "May ", "Jun ", "Jul ", "Aug ", "Sept ", "Oct ", "Nov ", "Dec "]
- Rectangle {
- width: 300
- height: 300
- anchors {
- top: parent.top
- horizontalCenter: parent.horizontalCenter
- }
- color: "pink"
- ColumnLayout {
- width: 300
- height: 300
- anchors {
- top: parent.top
- horizontalCenter: parent.horizontalCenter
- }
- Grid {
- Button {
- text: "back a month"
- onClicked: {
- if(months.month === 0) {
- months.month = 11
- months.year = months.year -1
- }
- else months.month = months.month -1
- }
- }
- Label {
- id: monthlist
- text: monthStrings[months.month] + months.year
- }
- Button {
- text: "Forward a month"
- onClicked: {
- if(months.month === 11) {
- months.month = 0
- months.year = months.year + 1
- }
- else months.month = months.month + 1
- }
- }
- }
- DayOfWeekRow {
- Layout.fillWidth: true
- }
- MonthGrid {
- id: months
- Layout.fillHeight: true
- Layout.fillWidth: true
- onClicked: {
- console.log(months.currentIndex)
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement