/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/1.2/Tab.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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /*
* Copyright 2012 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
/*!
\qmltype Tab
\inqmlmodule Ubuntu.Components 1.1
\ingroup ubuntu
\brief Component to represent a single tab in a \l Tabs environment.
Examples: See \l Tabs.
*/
PageTreeNode {
id: tab
anchors.fill: parent ? parent : undefined
/*!
The title that is shown on the tab button used to select this tab.
*/
property string title
/*!
\deprecated
The location of the icon that is displayed inside the button used to select this tab (optional).
Either \l title or iconSource, or both must be defined.
Deprecated because our new tab buttons in the header do not display an icon.
*/
property url iconSource
/*!
The contents of the Tab. Use a \l Page or a Loader that instantiates a Component or
loads an external \l Page.
When using a Loader, do not set the anchors or dimensions of the Loader so that the
\l Page can control the height and prevent overlapping the header.
Example:
\qml
import QtQuick 2.4
import Ubuntu.Components 1.2
MainView {
width: units.gu(40)
height: units.gu(50)
Component {
id: pageComponent
Page {
Label {
anchors.centerIn: parent
text: "Loaded when tab is selected."
}
}
}
Tabs {
id: tabs
Tab {
title: i18n.tr("Simple page")
page: Page {
Label {
anchors.centerIn: parent
text: i18n.tr("Always loaded")
}
}
}
Tab {
id: loaderTab
title: i18n.tr("Page loader")
page: Loader {
// no anchors
id: loader
sourceComponent: tabs.selectedTab == loaderTab ? pageComponent : null
onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded')
}
}
}
}
\endqml
*/
property Item page: null
// In case the page is a Loader with a Page inside, the Loader needs to be
// anchored to the bottom of the Tab. Width and height are set by the Page.
Binding {
target: page
property: "anchors.bottom"
value: tab.bottom
when: page
}
/*!
\qmlproperty int index
\readonly
The property holds the index of the tab within the Tabs.
*/
readonly property alias index: internal.index
/*!
When page is updated, set its parent to be tab.
*/
onPageChanged: if (page) page.parent = tab
/*!
The tab is active when it is the selected tab of its parent Tabs item.
Setting tab to active will automatically make child nodes active.
*/
active: parentNode && parentNode.active &&
parentNode.hasOwnProperty("selectedTab") && parentNode.selectedTab === tab
visible: active
/*!
\internal
*/
onTitleChanged: {
if (active) {
// ensure the parent node is an instance of Tabs
if (parentNode.hasOwnProperty("selectedTab")) {
parentNode.modelChanged();
}
}
}
/*!
\internal
*/
property alias __protected: internal
QtObject {
id: internal
/*
Specifies the index of the Tab in Tabs.
*/
property int index: -1
/*
Specifies whether the Tab has already been inserted in Tabs model or not.
Pre-declared tabs are added one by one automatically before Tabs component
completion, therefore we need this flag to exclude adding those Tab elements
again which were already added.
*/
property bool inserted: false
/*
Specifies whether the Tab was created dynamically or not. A dynamically created
Tab is destroyed upon removal.
*/
property bool dynamic: false
/*
This flag is used by the Tabs to determine whether the pre-declared Tab was removed
from the Tabs model or not. The flag guards adding back pre-declared tabs upon Tabs
component stack (children) change.
*/
property bool removedFromTabs: false
}
}
|