CalendarPanel: better auto sizing.

This commit is contained in:
ItsLemmy
2025-10-31 16:45:27 -04:00
parent 691dcc9c97
commit 82c6578a9f
2 changed files with 4 additions and 22 deletions
+4 -20
View File
@@ -44,25 +44,7 @@ NPanel {
return numWeeks * rowHeight
}
property real contentPreferredHeight: {
// Banner
const bannerHeight = 90 * Style.uiScaleRatio
// NBox (calendar grid container)
const navigationHeight = Style.baseWidgetSize // Navigation buttons row
const dayNamesHeight = Style.baseWidgetSize * 0.6 // Day names header row
const nboxInnerMargins = Style.marginM * 2 // Top and bottom margins inside NBox
const nboxHeight = navigationHeight + dayNamesHeight + calendarGridHeight + nboxInnerMargins
// Weather card
const weatherHeight = (Settings.data.location.weatherEnabled && Settings.data.location.showCalendarWeather ? 210 : 0) * Style.uiScaleRatio
// Main layout margins and spacing
const outerMargins = Style.marginM * 2 // Top and bottom margins of main ColumnLayout
const mainSpacing = Style.marginM * 2 // Spacing between banner and NBox, and NBox and weather (2 gaps)
return bannerHeight + nboxHeight + weatherHeight + outerMargins + mainSpacing
}
property real contentPreferredHeight: banner.height + calendar.height + weatherLoader.height + Style.marginM * 4 + (Settings.data.location.weatherEnabled && Settings.data.location.showCalendarWeather) * Style.marginM
ColumnLayout {
id: content
@@ -114,6 +96,7 @@ NPanel {
// Banner with date/time/clock
Rectangle {
id: banner
Layout.fillWidth: true
Layout.preferredHeight: capsuleColumn.implicitHeight + Style.marginM * 2
radius: Style.radiusL
@@ -243,6 +226,7 @@ NPanel {
// Calendar itself
NBox {
id: calendar
Layout.fillWidth: true
Layout.preferredHeight: {
const navigationHeight = Style.baseWidgetSize // Navigation buttons row
@@ -338,7 +322,7 @@ NPanel {
model: 7
Item {
Layout.fillWidth: true
Layout.preferredHeight: Style.baseWidgetSize * 0.6
Layout.preferredHeight: Style.fontSizeS * 2
NText {
anchors.centerIn: parent
text: {
-2
View File
@@ -60,8 +60,6 @@ Loader {
readonly property bool effectivePanelAnchorLeft: panelAnchorLeft || (useButtonPosition && barPosition === "left")
readonly property bool effectivePanelAnchorRight: panelAnchorRight || (useButtonPosition && barPosition === "right")
signal opened
signal closed