on xenial-before-2019-edge-merge help sign in
unity8/qml/Stage/WindowInfoItem.qml
53 lines 1.4 kB history raw
1import QtQuick 2.4
2import Ubuntu.Components 1.3
4Item {
5 id: root
6 implicitWidth: Math.max(iconShape.width, titleLabel.width)
7 implicitHeight: iconShape.height + titleLabel.height + labelMargin + iconMargin
8 property alias title: titleLabel.text
9 property alias iconSource: icon.source
11 property real iconHeight: (height - titleLabel.height) * 0.65
12 property real iconMargin: (height - titleLabel.height) * 0.25
13 property real labelMargin: (height - titleLabel.height) * 0.1
14 property int maxWidth: units.gu(10)
16 signal clicked()
18 ProportionalShape {
19 id: iconShape
20 anchors {
21 top: parent.top
22 topMargin: iconMargin
23 left: parent.left
24 }
25 height: iconHeight
26 borderSource: "undefined"
27 aspect: UbuntuShape.Flat
28 source: Image {
29 id: icon
30 sourceSize.width: iconShape.width
31 sourceSize.height: iconShape.height
32 cache: false // see lpbug#1543290 why no cache
33 }
34 }
36 MouseArea {
37 anchors.fill: iconShape
38 onClicked: root.clicked()
39 }
41 Label {
42 id: titleLabel
43 anchors {
44 left: iconShape.left
45 top: iconShape.bottom
46 topMargin: labelMargin
47 }
48 width: root.maxWidth
49 fontSize: 'small'
50 color: 'white'
51 elide: Label.ElideRight
52 }