summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatasof Wirapraja <anatasof.wirapraja@gmail.com>2023-03-03 21:05:57 +0700
committerAnatasof Wirapraja <anatasof.wirapraja@gmail.com>2023-03-03 21:05:57 +0700
commitb63c9ee0ce3d17675e5ad8c3c120fb8cea4f7bb0 (patch)
treeeaa23dc631df7aec969b484da39f44ea72d8cf3b
parente2ca2eaa7937a78ff0ed596bae7c8354a2cabf4e (diff)
parentaed499a0a6fdc43f61930dcd36bc04f5602cbaae (diff)
Merge commit 'aed499a0a6fdc43f61930dcd36bc04f5602cbaae'
-rw-r--r--HomeDefault.ui.qml50
-rw-r--r--TabItem.ui.qml4
2 files changed, 10 insertions, 44 deletions
diff --git a/HomeDefault.ui.qml b/HomeDefault.ui.qml
index 917102c..782d5f8 100644
--- a/HomeDefault.ui.qml
+++ b/HomeDefault.ui.qml
@@ -252,7 +252,6 @@ Flickable {
GridView {
id: tabs
- property int currentItemCount: 8
interactive: false
anchors {
left: parent.left
@@ -264,42 +263,21 @@ Flickable {
cellWidth: 142
cellHeight: 46
implicitHeight: width < 284 ? cellHeight * 5 : width < 426 ? cellHeight * 3 : width < 710 ? cellHeight * 2 : cellHeight
- model: ListModel {
- ListElement {
- label: "Web Design"
- count: 8
- }
- ListElement {
- label: "Development"
- count: 6
- }
- ListElement {
- label: "Graphic Design"
- count: 4
- }
- ListElement {
- label: "Marketing"
- count: 2
- }
- ListElement {
- label: "Finance"
- count: 2
- }
- }
+ model: ["Web Design", "Development", "Graphic Design", "Marketing", "Finance"]
delegate: TabItem {}
}
}
StackLayout {
currentIndex: tabs.currentIndex
- Layout.preferredHeight: width < 576 ? width * 1.3
- * tabs.currentItemCount
- : width < 768 ? width / 2 * 1.3
- * (tabs.currentItemCount + tabs.currentItemCount % 2) / 2
- : width < 992 ? width / 3 * 1.3
- * (tabs.currentItemCount + (tabs.currentItemCount + 1) % 3) / 3
- : width / 4 * 1.3
- * (tabs.currentItemCount + (tabs.currentItemCount + 2) % 4) / 4
+ property int currentCount: tabsContent.itemAt(currentIndex).count
+ Layout.preferredHeight: width < 576
+ ? width * 1.3 * currentCount
+ : width < 768
+ ? width / 2 * 1.3 * (currentCount + currentCount % 2) / 2
+ : width < 992
+ ? width / 3 * 1.3 * (currentCount + (currentCount + 1) % 3) / 3
+ : width / 4 * 1.3 * (currentCount + (currentCount + 2) % 4) / 4
Repeater {
id: tabsContent
@@ -382,16 +360,6 @@ Flickable {
: width < 992 ? width / 3
: width / 4
cellHeight: cellWidth * 1.3
- height: width < 576
- ? cellHeight * count
- : width < 768
- ? cellHeight
- * (count + count % 2) / 2
- : width < 992
- ? cellHeight
- * (count + (count + 1) % 3) / 3
- : cellHeight
- * (count + (count + 2) % 4) / 4
model: content
delegate: CardGrid {
width: tabPane.cellWidth
diff --git a/TabItem.ui.qml b/TabItem.ui.qml
index bf895d4..e0bb31c 100644
--- a/TabItem.ui.qml
+++ b/TabItem.ui.qml
@@ -2,7 +2,6 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
Button {
- id: button
property int currentIndex: 0
property bool doesntEmbed: Qt.platform.os === "android"
|| Qt.platform.os === "linux"
@@ -18,9 +17,8 @@ Button {
height: 38
horizontalPadding: 16
verticalPadding: 8
- text: label
contentItem: Text {
- text: button.text
+ text: modelData
color: index == currentIndex ? "white" : "#066ac9"
font {
family: doesntEmbed ? "Roboto" : regular.name