mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 01:13: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
|
||||
visible: true
|
||||
title: qsTr("Hello World")
|
||||
|
||||
|
||||
property bool isPhone: root.width < root.height
|
||||
|
||||
property string selectedView: "list"
|
||||
|
||||
|
@ -99,13 +98,13 @@ Window {
|
|||
}
|
||||
|
||||
function setFittingLayout() {
|
||||
if (width > height) {
|
||||
desktopLayout.visible = true
|
||||
phoneLayout.visible = false
|
||||
} else {
|
||||
if (root.isPhone) {
|
||||
desktopLayout.visible = false
|
||||
phoneLayout.visible = true
|
||||
phoneLayout.setCurrentIndex(1)
|
||||
phoneLayout.setCurrentIndex(1)
|
||||
} else {
|
||||
desktopLayout.visible = true
|
||||
phoneLayout.visible = false
|
||||
}
|
||||
}
|
||||
onWidthChanged: setFittingLayout()
|
||||
|
|
|
@ -10,6 +10,7 @@ import QtQuick.Layouts
|
|||
import Mirai
|
||||
|
||||
ColumnLayout {
|
||||
property int numberOfDaysPerPage: 7
|
||||
id: control
|
||||
spacing: 32
|
||||
QtObject {
|
||||
|
@ -33,7 +34,7 @@ ColumnLayout {
|
|||
AppButton {
|
||||
text: "<"
|
||||
onClicked: {
|
||||
internal.weekStartDate.setDate(internal.weekStartDate.getDate() - 7)
|
||||
internal.weekStartDate.setDate(internal.weekStartDate.getDate() - control.numberOfDaysPerPage)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +48,7 @@ ColumnLayout {
|
|||
AppButton {
|
||||
text: ">"
|
||||
onClicked: {
|
||||
internal.weekStartDate.setDate(internal.weekStartDate.getDate() + 7)
|
||||
internal.weekStartDate.setDate(internal.weekStartDate.getDate() + control.numberOfDaysPerPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
Repeater {
|
||||
model: 7
|
||||
model: control.numberOfDaysPerPage
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -18,6 +18,7 @@ ColumnLayout {
|
|||
Calendar {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
numberOfDaysPerPage: root.isPhone ? 1 : 7
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue