Dekko
Loading...
Searching...
No Matches
TabBar.qml
1/* Copyright (C) 2016 - 2017 Dan Chapman <dpniel@ubuntu.com>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18import QtQuick 2.4
19import Lomiri.Components 1.3
20import Dekko.Components 1.0
21
22PixelPerfectItem {
23 id: tabBar
24 property int currentIndex: 0
25 property alias iconNameModel: rp.model
26 height: units.gu(6)
27
28 Row {
29 id: actionRow
30 width: parent.width
31 height: parent.height
32
33 Repeater {
34 id: rp
35 delegate: Rectangle {
36 id: btn
37 width: tabBar.width / 4
38 height: parent.height
39 AbstractButton {
40 anchors.fill: parent
41 onPressedChanged: pressed ? btn.color = LomiriColors.lightGrey : btn.color = "transparent"
42 onClicked: tabBar.currentIndex = model.index
43 Icon {
44 height: units.gu(2.5); width: height
45 name: modelData
46 anchors.centerIn: parent
47 color: tabBar.currentIndex === model.index ? LomiriColors.blue : LomiriColors.ash
48 }
49 }
50 Rectangle {
51 anchors {
52 left: parent.left
53 bottom: parent.bottom
54 right: parent.right
55 }
56 height: units.dp(2)
57 color: tabBar.currentIndex === model.index ? LomiriColors.blue : LomiriColors.ash
58 }
59 }
60 }
61 }
62 Rectangle {
63 anchors {
64 left: parent.left
65 right: parent.right
66 top: tabBar.top
67 }
68 height: units.dp(1)
69 color: LomiriColors.lightGrey
70 }
71}
72