formatter
This commit is contained in:
@@ -10,17 +10,17 @@ RowLayout {
|
||||
spacing: 12
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: 40
|
||||
color: "transparent"
|
||||
radius: 1000
|
||||
|
||||
MaterialIcon {
|
||||
anchors.centerIn: parent
|
||||
text: "arrow_back_2"
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
fill: 1
|
||||
font.pointSize: 24
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
text: "arrow_back_2"
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
@@ -36,30 +36,27 @@ RowLayout {
|
||||
}
|
||||
|
||||
CustomText {
|
||||
text: new Date(Calendar.displayYear, Calendar.displayMonth, 1).toLocaleDateString(
|
||||
Qt.locale(),
|
||||
"MMMM yyyy"
|
||||
)
|
||||
font.weight: 600
|
||||
font.pointSize: 14
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
Layout.fillWidth: true
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
font.pointSize: 14
|
||||
font.weight: 600
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: new Date(Calendar.displayYear, Calendar.displayMonth, 1).toLocaleDateString(Qt.locale(), "MMMM yyyy")
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: 40
|
||||
color: "transparent"
|
||||
radius: 1000
|
||||
|
||||
MaterialIcon {
|
||||
anchors.centerIn: parent
|
||||
text: "arrow_back_2"
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
fill: 1
|
||||
font.pointSize: 24
|
||||
rotation: 180
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
text: "arrow_back_2"
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
|
||||
@@ -11,8 +11,8 @@ Item {
|
||||
|
||||
required property Item wrapper
|
||||
|
||||
implicitWidth: layout.childrenRect.width + layout.anchors.margins * 2
|
||||
implicitHeight: layout.childrenRect.height + layout.anchors.margins * 2
|
||||
implicitWidth: layout.childrenRect.width + layout.anchors.margins * 2
|
||||
|
||||
ColumnLayout {
|
||||
id: layout
|
||||
@@ -59,17 +59,17 @@ Item {
|
||||
|
||||
DayOfWeekRow {
|
||||
id: dayOfWeekRow
|
||||
locale: Qt.locale()
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 30
|
||||
locale: Qt.locale()
|
||||
}
|
||||
|
||||
MonthGrid {
|
||||
locale: Qt.locale()
|
||||
|
||||
wrapper: root.wrapper
|
||||
Layout.preferredWidth: childrenRect.width
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
Layout.preferredWidth: childrenRect.width
|
||||
locale: Qt.locale()
|
||||
wrapper: root.wrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,39 +7,36 @@ import qs.Config
|
||||
import qs.Helpers
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
id: root
|
||||
|
||||
required property var locale
|
||||
required property var locale
|
||||
|
||||
spacing: 4
|
||||
spacing: 4
|
||||
|
||||
Repeater {
|
||||
model: 7
|
||||
Repeater {
|
||||
model: 7
|
||||
|
||||
Item {
|
||||
required property int index
|
||||
Item {
|
||||
readonly property string dayName: {
|
||||
// Get the day name for this column
|
||||
const dayIndex = (index + Calendar.weekStartDay) % 7;
|
||||
return root.locale.dayName(dayIndex, Locale.ShortFormat);
|
||||
}
|
||||
required property int index
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 30
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 30
|
||||
|
||||
readonly property string dayName: {
|
||||
// Get the day name for this column
|
||||
const dayIndex = (index + Calendar.weekStartDay) % 7;
|
||||
return root.locale.dayName(dayIndex, Locale.ShortFormat);
|
||||
}
|
||||
|
||||
CustomText {
|
||||
anchors.centerIn: parent
|
||||
|
||||
text: parent.dayName
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
opacity: 0.8
|
||||
font.weight: 500
|
||||
font.pointSize: 11
|
||||
}
|
||||
}
|
||||
}
|
||||
CustomText {
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: 11
|
||||
font.weight: 500
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
opacity: 0.8
|
||||
text: parent.dayName
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,48 +13,49 @@ GridLayout {
|
||||
required property var locale
|
||||
required property Item wrapper
|
||||
|
||||
columnSpacing: 4
|
||||
columns: 7
|
||||
rowSpacing: 4
|
||||
columnSpacing: 4
|
||||
uniformCellWidths: true
|
||||
uniformCellHeights: true
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
target: root
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
}
|
||||
uniformCellWidths: true
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
model: ScriptModel {
|
||||
values: Calendar.getWeeksForMonth(Calendar.displayMonth, Calendar.displayYear)
|
||||
|
||||
Behavior on values {
|
||||
SequentialAnimation {
|
||||
id: switchAnim
|
||||
|
||||
ParallelAnimation {
|
||||
Anim {
|
||||
property: "opacity"
|
||||
from: 1.0
|
||||
property: "opacity"
|
||||
to: 0.0
|
||||
}
|
||||
|
||||
Anim {
|
||||
property: "scale"
|
||||
from: 1.0
|
||||
property: "scale"
|
||||
to: 0.8
|
||||
}
|
||||
}
|
||||
PropertyAction {}
|
||||
|
||||
PropertyAction {
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
Anim {
|
||||
property: "opacity"
|
||||
from: 0.0
|
||||
property: "opacity"
|
||||
to: 1.0
|
||||
}
|
||||
|
||||
Anim {
|
||||
property: "scale"
|
||||
from: 0.8
|
||||
property: "scale"
|
||||
to: 1.0
|
||||
}
|
||||
}
|
||||
@@ -63,15 +64,11 @@ GridLayout {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
required property var modelData
|
||||
required property int index
|
||||
required property var modelData
|
||||
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: width
|
||||
|
||||
|
||||
radius: 1000
|
||||
Layout.preferredWidth: 40
|
||||
color: {
|
||||
if (modelData.isToday) {
|
||||
console.log(width);
|
||||
@@ -79,39 +76,52 @@ GridLayout {
|
||||
}
|
||||
return "transparent";
|
||||
}
|
||||
radius: 1000
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 200 }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
anchors.centerIn: parent
|
||||
|
||||
text: parent.modelData.day.toString()
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
opacity: parent.modelData.isCurrentMonth ? 1.0 : 0.4
|
||||
color: {
|
||||
if (parent.modelData.isToday) {
|
||||
return DynamicColors.palette.m3onPrimaryContainer;
|
||||
}
|
||||
return DynamicColors.palette.m3onSurface;
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
opacity: parent.modelData.isCurrentMonth ? 1.0 : 0.4
|
||||
text: parent.modelData.day.toString()
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation { duration: 200 }
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 200 }
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
color: DynamicColors.palette.m3onSurface
|
||||
|
||||
onClicked: {
|
||||
console.log(`Selected date: ${parent.modelData.day}/${parent.modelData.month + 1}/${parent.modelData.year}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component Anim: NumberAnimation {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
target: root
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,38 +8,38 @@ import qs.Config
|
||||
import qs.Helpers
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
id: root
|
||||
|
||||
spacing: 4
|
||||
readonly property var weekNumbers: Calendar.getWeekNumbers(Calendar.displayMonth, Calendar.displayYear)
|
||||
|
||||
readonly property var weekNumbers: Calendar.getWeekNumbers(Calendar.displayMonth, Calendar.displayYear)
|
||||
spacing: 4
|
||||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
values: root.weekNumbers
|
||||
}
|
||||
|
||||
Item {
|
||||
id: weekItem
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: 20
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Item {
|
||||
id: weekItem
|
||||
|
||||
required property int index
|
||||
required property var modelData
|
||||
required property int index
|
||||
required property var modelData
|
||||
|
||||
CustomText {
|
||||
id: weekText
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: 20
|
||||
|
||||
anchors.centerIn: parent
|
||||
CustomText {
|
||||
id: weekText
|
||||
|
||||
text: weekItem.modelData
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
opacity: 0.5
|
||||
font.pointSize: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
opacity: 0.5
|
||||
text: weekItem.modelData
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user