-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavigationMenu.qml
More file actions
159 lines (135 loc) · 4.64 KB
/
NavigationMenu.qml
File metadata and controls
159 lines (135 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
// NavigationMenu.qml
// Horizontal navigation bar for switching between sections
Rectangle {
id: navMenu
color: "#ffffff"
height: 50
border.width: 1
border.color: "#e5e7eb"
// Signals for navigation
signal homePage
signal browsePage
signal addPage
signal searchPage
property string currentPage: "home"
RowLayout {
anchors.fill: parent
anchors.margins: 10
spacing: 5
// App logo/name
Text {
text: "📚 Library"
font.pixelSize: 16
font.bold: true
color: "#1f2937"
Layout.margins: 5
}
Rectangle {
width: 1
height: 30
color: "#d1d5db"
Layout.margins: 5
}
// Navigation buttons
Button {
text: "Home"
Layout.preferredWidth: 80
Layout.preferredHeight: 35
flat: true
background: Rectangle {
color: navMenu.currentPage === "home" ? "#eff6ff" : "transparent"
radius: 4
border.color: navMenu.currentPage === "home" ? "#3b82f6" : "transparent"
border.width: 1
}
contentItem: Text {
text: parent.text
color: navMenu.currentPage === "home" ? "#1e40af" : "#6b7280"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 12
font.bold: navMenu.currentPage === "home"
}
onClicked: {
currentPage = "home"
homePage()
}
}
Button {
text: "Browse"
Layout.preferredWidth: 80
Layout.preferredHeight: 35
flat: true
background: Rectangle {
color: navMenu.currentPage === "browse" ? "#eff6ff" : "transparent"
radius: 4
border.color: navMenu.currentPage === "browse" ? "#3b82f6" : "transparent"
border.width: 1
}
contentItem: Text {
text: parent.text
color: navMenu.currentPage === "browse" ? "#1e40af" : "#6b7280"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 12
font.bold: navMenu.currentPage === "browse"
}
onClicked: {
currentPage = "browse"
browsePage()
}
}
Button {
text: "Add Book"
Layout.preferredWidth: 80
Layout.preferredHeight: 35
flat: true
background: Rectangle {
color: navMenu.currentPage === "add" ? "#eff6ff" : "transparent"
radius: 4
border.color: navMenu.currentPage === "add" ? "#3b82f6" : "transparent"
border.width: 1
}
contentItem: Text {
text: parent.text
color: navMenu.currentPage === "add" ? "#1e40af" : "#6b7280"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 12
font.bold: navMenu.currentPage === "add"
}
onClicked: {
currentPage = "add"
addPage()
}
}
Button {
text: "Search"
Layout.preferredWidth: 80
Layout.preferredHeight: 35
flat: true
background: Rectangle {
color: navMenu.currentPage === "search" ? "#eff6ff" : "transparent"
radius: 4
border.color: navMenu.currentPage === "search" ? "#3b82f6" : "transparent"
border.width: 1
}
contentItem: Text {
text: parent.text
color: navMenu.currentPage === "search" ? "#1e40af" : "#6b7280"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 12
font.bold: navMenu.currentPage === "search"
}
onClicked: {
currentPage = "search"
searchPage()
}
}
Item { Layout.fillWidth: true }
}
}