on bb09f86 help sign in
unity8/qml/Dash/DashSectionHeader.qml
64 lines 1.7 kB history raw
1/*
2 * Copyright (C) 2013,2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17import QtQuick 2.4
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
21Item {
22 property alias text: label.text
23 property alias color: label.color
24 property alias iconName: icon.name
26 signal clicked(variant mouse)
28 height: units.gu(5)
30 Label {
31 id: label
33 anchors {
34 left: parent.left
35 leftMargin: units.gu(2)
36 verticalCenter: parent.verticalCenter
37 }
39 font.family: "Ubuntu"
40 fontSize: "medium"
41 elide: Text.ElideRight
42 maximumLineCount: 1
43 textFormat: Text.PlainText
44 width: Math.min(parent.width - units.gu(4), implicitWidth)
45 }
47 Icon {
48 id: icon
49 visible: name != ""
50 height: units.gu(1.25)
51 width: height
52 color: label.color
53 anchors {
54 left: label.right
55 leftMargin: units.gu(0.25)
56 verticalCenter: parent.verticalCenter
57 }
58 }
60 MouseArea {
61 anchors.fill: parent
62 onClicked: parent.clicked(mouse)
63 }