mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Only show 1 Calendar day on phone
This commit is contained in:
parent
da3f33849a
commit
bf50484d40
3 changed files with 11 additions and 10 deletions
|
@ -16,8 +16,7 @@ Window {
|
||||||
height: 480
|
height: 480
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr("Hello World")
|
title: qsTr("Hello World")
|
||||||
|
property bool isPhone: root.width < root.height
|
||||||
|
|
||||||
|
|
||||||
property string selectedView: "list"
|
property string selectedView: "list"
|
||||||
|
|
||||||
|
@ -99,13 +98,13 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFittingLayout() {
|
function setFittingLayout() {
|
||||||
if (width > height) {
|
if (root.isPhone) {
|
||||||
desktopLayout.visible = true
|
|
||||||
phoneLayout.visible = false
|
|
||||||
} else {
|
|
||||||
desktopLayout.visible = false
|
desktopLayout.visible = false
|
||||||
phoneLayout.visible = true
|
phoneLayout.visible = true
|
||||||
phoneLayout.setCurrentIndex(1)
|
phoneLayout.setCurrentIndex(1)
|
||||||
|
} else {
|
||||||
|
desktopLayout.visible = true
|
||||||
|
phoneLayout.visible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onWidthChanged: setFittingLayout()
|
onWidthChanged: setFittingLayout()
|
||||||
|
|
|
@ -10,6 +10,7 @@ import QtQuick.Layouts
|
||||||
import Mirai
|
import Mirai
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
property int numberOfDaysPerPage: 7
|
||||||
id: control
|
id: control
|
||||||
spacing: 32
|
spacing: 32
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -33,7 +34,7 @@ ColumnLayout {
|
||||||
AppButton {
|
AppButton {
|
||||||
text: "<"
|
text: "<"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
internal.weekStartDate.setDate(internal.weekStartDate.getDate() - 7)
|
internal.weekStartDate.setDate(internal.weekStartDate.getDate() - control.numberOfDaysPerPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ ColumnLayout {
|
||||||
AppButton {
|
AppButton {
|
||||||
text: ">"
|
text: ">"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
internal.weekStartDate.setDate(internal.weekStartDate.getDate() + 7)
|
internal.weekStartDate.setDate(internal.weekStartDate.getDate() + control.numberOfDaysPerPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: 7
|
model: control.numberOfDaysPerPage
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
|
@ -18,6 +18,7 @@ ColumnLayout {
|
||||||
Calendar {
|
Calendar {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
numberOfDaysPerPage: root.isPhone ? 1 : 7
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue