From a1c57c75157d799aa824ede8c5e3df466266c5b4 Mon Sep 17 00:00:00 2001 From: Daan Wijffels Date: Sat, 27 Jan 2024 01:02:09 +0100 Subject: [PATCH 1/3] Added dynamic scaling of header --- src/qml/components/Page.qml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/qml/components/Page.qml b/src/qml/components/Page.qml index 4fcf5ab..c1aa394 100644 --- a/src/qml/components/Page.qml +++ b/src/qml/components/Page.qml @@ -30,6 +30,7 @@ ListView { property string _id: pageId property QtObject items: pageItems property bool isCurrentItem: ListView.isCurrentItem + property int headerHeight: 260 Behavior on height { NumberAnimation { easing.type: Easing.OutExpo; duration: 200 } @@ -65,6 +66,16 @@ ListView { } } } + onContentYChanged: { + // Adjust the height of the header image based on overscroll + if (contentY < -260){ + headerHeight= Math.max(-contentY, 260); // Adjust these values as needed + if (!dragging){ + contentY = -260; + } + } + + } DelegateModel { id: visualModel @@ -81,7 +92,7 @@ ListView { Image { id: headerImage - width: parent.width; height: 260 + width: parent.width; height: headerHeight source: resource.getBackgroundImage(pageImage) sourceSize.width: parent.width sourceSize.height: 260 @@ -248,7 +259,6 @@ ListView { onReleased: { page.interactive = true; - if (held) { Haptic.play(Haptic.Click); held = false; @@ -361,3 +371,4 @@ ListView { } } } + From 22b365d2b4c18e2c5768288de4fce72435b6a3ac Mon Sep 17 00:00:00 2001 From: Daan Wijffels Date: Sat, 27 Jan 2024 11:29:26 +0100 Subject: [PATCH 2/3] Disable of scrolling when no items on page --- src/qml/components/Page.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qml/components/Page.qml b/src/qml/components/Page.qml index c1aa394..6456a54 100644 --- a/src/qml/components/Page.qml +++ b/src/qml/components/Page.qml @@ -25,6 +25,9 @@ ListView { model: visualModel header: header currentIndex: 0 + + // Disable scrolling when no items on page, otherwise header is movable + interactive: visualModel.count property string title: pageName property string _id: pageId @@ -32,6 +35,7 @@ ListView { property bool isCurrentItem: ListView.isCurrentItem property int headerHeight: 260 + Behavior on height { NumberAnimation { easing.type: Easing.OutExpo; duration: 200 } } @@ -69,7 +73,8 @@ ListView { onContentYChanged: { // Adjust the height of the header image based on overscroll if (contentY < -260){ - headerHeight= Math.max(-contentY, 260); // Adjust these values as needed + headerHeight= Math.max(-contentY, 260); + // Return the header to its normal size when we release if (!dragging){ contentY = -260; } From 68742e046cbc283c2e13d48fee07cba0c3404fa8 Mon Sep 17 00:00:00 2001 From: Daan Wijffels Date: Sat, 27 Jan 2024 11:29:35 +0100 Subject: [PATCH 3/3] Updated translations --- resources/translations/da_DK.ts | 4 ++-- resources/translations/de_CH.ts | 4 ++-- resources/translations/de_DE.ts | 4 ++-- resources/translations/en_US.ts | 4 ++-- resources/translations/fr_FR.ts | 4 ++-- resources/translations/hu_HU.ts | 4 ++-- resources/translations/it_IT.ts | 4 ++-- resources/translations/nl_NL.ts | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/resources/translations/da_DK.ts b/resources/translations/da_DK.ts index 84727b8..e5dcf63 100644 --- a/resources/translations/da_DK.ts +++ b/resources/translations/da_DK.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 is %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Press and hold the Home button or use the Web Configurator to configure the page diff --git a/resources/translations/de_CH.ts b/resources/translations/de_CH.ts index 1583736..a395026 100644 --- a/resources/translations/de_CH.ts +++ b/resources/translations/de_CH.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 ist %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Heb d Home-Taschte drückt oder bruch dr Web-Konfigurator für d Siite ds konfiguriere diff --git a/resources/translations/de_DE.ts b/resources/translations/de_DE.ts index 9f2eac1..f4abd9b 100644 --- a/resources/translations/de_DE.ts +++ b/resources/translations/de_DE.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 ist %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Um die Seite zu anzupassen, Home-Taste gedrückt halten oder Web-Konfigurator verwenden diff --git a/resources/translations/en_US.ts b/resources/translations/en_US.ts index d7a22a8..7a47f5c 100644 --- a/resources/translations/en_US.ts +++ b/resources/translations/en_US.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation diff --git a/resources/translations/fr_FR.ts b/resources/translations/fr_FR.ts index 9467c74..1383746 100644 --- a/resources/translations/fr_FR.ts +++ b/resources/translations/fr_FR.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 est %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Appuyez et maintenez le bouton Accueil ou utilisez le configurateur web pour configurer la page diff --git a/resources/translations/hu_HU.ts b/resources/translations/hu_HU.ts index ba0abe6..e19c84a 100644 --- a/resources/translations/hu_HU.ts +++ b/resources/translations/hu_HU.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 is %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Press and hold the Home button or use the Web Configurator to configure the page diff --git a/resources/translations/it_IT.ts b/resources/translations/it_IT.ts index bf8d75d..eb48dbc 100644 --- a/resources/translations/it_IT.ts +++ b/resources/translations/it_IT.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 is %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Tieni premuto il pulsante Home o usa il configuratore Web per configurare la pagina diff --git a/resources/translations/nl_NL.ts b/resources/translations/nl_NL.ts index 2f39c99..3bf9ac1 100644 --- a/resources/translations/nl_NL.ts +++ b/resources/translations/nl_NL.ts @@ -1446,13 +1446,13 @@ Climate fan Page - + %1 is %2 Used to show the entity state: %1 is the entity name, %2 is the state %1 is %2 - + Press and hold the Home button or use the Web Configurator to configure the page Web configurator is the name of the application, does not need translation Houd de Home-knop ingedrukt of gebruik de webconfigurator om de pagina te configureren