summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-03 09:47:57 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-03 09:47:57 +0800
commit232f00fb063795b6d60116517af6e6839368dd16 (patch)
treeb01f9726afec5bb51bbb77097bb12154ef2c0857
parentd70d0d4feadeb113d7ef380581c2d031c24185ed (diff)
Calculate just once, simplify
-rw-r--r--HomeDefault.ui.qml13
1 files changed, 5 insertions, 8 deletions
diff --git a/HomeDefault.ui.qml b/HomeDefault.ui.qml
index 25c8457..782d5f8 100644
--- a/HomeDefault.ui.qml
+++ b/HomeDefault.ui.qml
@@ -270,17 +270,14 @@ Flickable {
StackLayout {
currentIndex: tabs.currentIndex
+ property int currentCount: tabsContent.itemAt(currentIndex).count
Layout.preferredHeight: width < 576
- ? width * 1.3
- * tabsContent.itemAt(currentIndex).count
+ ? width * 1.3 * currentCount
: width < 768
- ? width / 2 * 1.3
- * (tabsContent.itemAt(currentIndex).count + tabsContent.itemAt(currentIndex).count % 2) / 2
+ ? width / 2 * 1.3 * (currentCount + currentCount % 2) / 2
: width < 992
- ? width / 3 * 1.3
- * (tabsContent.itemAt(currentIndex).count + (tabsContent.itemAt(currentIndex).count + 1) % 3) / 3
- : width / 4 * 1.3
- * (tabsContent.itemAt(currentIndex).count + (tabsContent.itemAt(currentIndex).count + 2) % 4) / 4
+ ? width / 3 * 1.3 * (currentCount + (currentCount + 1) % 3) / 3
+ : width / 4 * 1.3 * (currentCount + (currentCount + 2) % 4) / 4
Repeater {
id: tabsContent