Unity 8
 All Classes Functions Properties
Header.qml
1 /*
2  * Copyright (C) 2013 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  */
16 
17 import QtQuick 2.0
18 import Ubuntu.Components 0.1
19 
20 Item {
26  property alias text: label.text
27  property alias textColor: label.color
28  property alias image: image.source
29 
30  signal clicked(variant mouse)
31 
32  height: units.gu(5)
33 
34  Item {
35  anchors {
36  left: parent.left
37  right: parent.right
38  rightMargin: units.gu(0.5)
39  top: parent.top
40  bottom: parent.bottom
41  }
42 
43  Label {
44  id: label
45  anchors {
46  left: parent.left
47  leftMargin: units.gu(2)
48  verticalCenter: parent.verticalCenter
49  }
50 
51  color: "grey" // TODO karni: Update Ubuntu.Compoonents.Themes.Palette.
52  font.family: "Ubuntu"
53  fontSize: "medium"
54  elide: Text.ElideRight
55  textFormat: Text.PlainText
56  width: parent.width - image.width - image.leftMargin - anchors.leftMargin
57  }
58 
59  Image {
60  id: image
61  readonly property double leftMargin: units.gu(1)
62  x: label.x + label.contentWidth + leftMargin
63  anchors {
64  verticalCenter: parent.verticalCenter
65  }
66  }
67  }
68 
69  MouseArea {
70  anchors.fill: parent
71  onClicked: parent.clicked(mouse)
72  }
73 }