/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/1.3/Captions.qml is in qml-module-ubuntu-components 1.3.1918+16.04.20160404-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /*
* Copyright 2015 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import QtQuick.Layouts 1.1
import Ubuntu.Components 1.3
/*!
\qmltype Captions
\inqmlmodule Ubuntu.Components 1.2
\ingroup ubuntu-listitem
\since Ubuntu.Components 1.2
\brief Container providing captionStyles for a twin-label column that can be used in
RowLayout or GridLayout.
The labels are placed in a column and can be accessed through \l title and
\l subtitle properties. The default spacing between the labels is 0.5 grid units.
The container only shows the labels which has its text property set to a valid
string. The labels not having any text set are not occupying the space. When
embedded in a positioner or in a RowLayout, the container is aligned vertically
centered. It is recommended to be used in context with RowLayout or GridLayout,
however can be used with any component.
\qml
import QtQuick 2.4
import Ubuntu.Components 1.3
ListItem {
RowLayout {
Captions {
title.text: "Caption"
subtitle.text: "Subtitle text"
// attached properties of an Item type property
// can be changed only with assignment
Component.onCompleted: subtitle.Layout.alignment = Qt.AlignRight
}
Captions {
captionStyle: Ubuntu.SummaryCaptionStyle
title.text: "Text"
subtitle.text: "Text"
}
}
}
\endqml
Additional items can also be added to the layout after the two labels.
\qml
Captions {
title.text: "Caption"
subtitle.text: "Subtitle"
Label {
text: "third line"
textSize: Label.XxSmall
}
}
\endqml
*/
ColumnLayout {
id: captions
/*!
\qmlproperty enumeration captionStyle
The property configures the arrangement and font sizes of the Labels in the
component. It can take the following values:
\list
\li \b Ubuntu.TitleCaptionStyle - (default) typical configuration for a left aligned
twin-label setup, where the text covers the remaining area on a list
layout.
\li \b Ubuntu.SummaryCaptionStyle - configuration for a right-aligned twin label setup,
with 6 grid units width.
\endlist
*/
property int captionStyle: Ubuntu.TitleCaptionStyle
/*!
\qmlproperty Label title
\readonly
Label occupying the top area of the container.
*/
property alias title: titleLabel
/*!
\qmlproperty Label subtitle
\readonly
Label occupying the bottom area of the container.
*/
property alias subtitle: subtitleLabel
clip: true
spacing: units.gu(0.5)
Layout.fillWidth: (captionStyle == Ubuntu.TitleCaptionStyle)
Layout.alignment: Qt.AlignVCenter | ((captionStyle == Ubuntu.SummaryCaptionStyle) ? Qt.AlignRight : Qt.AlignLeft)
Layout.minimumWidth: 0
Layout.maximumWidth: (captionStyle == Ubuntu.SummaryCaptionStyle) ? units.gu(6) : parent.width
Layout.preferredWidth: (captionStyle == Ubuntu.SummaryCaptionStyle) ? Layout.maximumWidth : 0
Layout.minimumHeight: 0
Layout.maximumHeight: parent ? parent.height : childrenRect.height
Layout.preferredHeight: childrenRect.height
// handle visibility, do not override visible property!
// 'hide' column if title and subtitle is an empty string and
// there's no more children added
states: State {
name: "__q_invisible"
when: (title.text === "" && subtitle.text === "") && (captions.children.length == 2)
PropertyChanges {
target: captions
visible: false
}
}
Label {
id: titleLabel
anchors {
left: parent.left
right: parent.right
}
textSize: (captionStyle == Ubuntu.SummaryCaptionStyle) ? Label.Small : Label.Medium
horizontalAlignment: (captionStyle == Ubuntu.SummaryCaptionStyle) ? Text.AlignRight : Text.AlignLeft
visible: text !== ""
elide: (captionStyle == Ubuntu.TitleCaptionStyle) ? Text.ElideRight : Text.ElideNone
}
Label {
id: subtitleLabel
anchors {
left: parent.left
right: parent.right
}
textSize: Label.Small
horizontalAlignment: (captionStyle == Ubuntu.SummaryCaptionStyle) ? Text.AlignRight : Text.AlignLeft
visible: text !== ""
maximumLineCount: (captionStyle == Ubuntu.TitleCaptionStyle) ? 2 : 1
wrapMode: (captionStyle == Ubuntu.TitleCaptionStyle) ? Text.Wrap : Text.NoWrap
elide: (captionStyle == Ubuntu.TitleCaptionStyle) ? Text.ElideRight : Text.ElideNone
}
}
|