~unity-team/unity8/dash-only

« back to all changes in this revision

Viewing changes to qml/Components/ListItems/Header.qml

  • Committer: Kevin Gunn
  • Date: 2016-10-24 19:51:33 UTC
  • Revision ID: kevin.gunn@canonical.com-20161024195133-61lwdzzdwsnue1mn
shave some more

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 */
16
 
 
17
 
import QtQuick 2.4
18
 
import QtQuick.Layouts 1.1
19
 
import Ubuntu.Components 1.3
20
 
 
21
 
Item {
22
 
    property alias text: label.text
23
 
    property alias color: label.color
24
 
    property alias iconName: icon.name
25
 
 
26
 
    signal clicked(variant mouse)
27
 
 
28
 
    height: units.gu(5)
29
 
 
30
 
    RowLayout {
31
 
        spacing: units.gu(.5)
32
 
        anchors {
33
 
            left: parent.left
34
 
            right: parent.right
35
 
            verticalCenter: parent.verticalCenter
36
 
            margins: units.gu(1)
37
 
        }
38
 
 
39
 
        Label {
40
 
            id: label
41
 
            Layout.fillWidth: true
42
 
 
43
 
            font.family: "Ubuntu"
44
 
            fontSize: "medium"
45
 
            elide: Text.ElideRight
46
 
            maximumLineCount: 1
47
 
            textFormat: Text.PlainText
48
 
            width: Math.min(parent.width - units.gu(4), implicitWidth)
49
 
        }
50
 
 
51
 
        Icon {
52
 
            id: icon
53
 
            visible: name != ""
54
 
            height: units.gu(2)
55
 
            width: height
56
 
            color: label.color
57
 
        }
58
 
    }
59
 
 
60
 
    MouseArea {
61
 
        anchors.fill: parent
62
 
        onClicked: parent.clicked(mouse)
63
 
    }
64
 
}