I was writing my custom calendar and ran into the following problem. My rectangle is larger than my delegate, and the delegate is partially rendered twice. How can I fix this without changing the rectangle size?
enter image description here
import QtQuick
import QtQuick.Controls
Rectangle {
id: _calendar
width: (276)
height: (302)
radius: (12)
color: "#1D1D1D"
border { width: (1); color: "#404040" }
Column {
x: (20)
y: (16)
spacing: 0
ListView {
id: _calendarView
width: (236)
height: (202)
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
spacing: 1
model: CalendarModel {
id: _model
from: new Date(2024,3,1)
to: new Date(2024,7,31)
}
delegate: MonthGrid {
id: _monthGrid
delegate: Label {
required property var model
width: 34
height: 34
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: (14)
font.bold: true
opacity: model.month === _monthGrid.month ? 1 : 0.5
color: "#FFFFFF"
text: model.day
}
}
}
}
}