| 1 |
/* |
| 2 |
* Copyright 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 Lesser 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 Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.4 |
| 18 |
|
| 19 |
/*! \internal */ |
| 20 |
// Documentation in Page.qdoc |
| 21 |
Page10 { |
| 22 |
id: page |
| 23 |
/*! |
| 24 |
\qmlproperty PageHeadConfiguration head |
| 25 |
*/ |
| 26 |
readonly property alias head: headerConfig |
| 27 |
PageHeadConfiguration { |
| 28 |
id: headerConfig |
| 29 |
} |
| 30 |
|
| 31 |
onToolsChanged: { |
| 32 |
print("Page.tools is a deprecated property. Please use Page.head instead."); |
| 33 |
} |
| 34 |
|
| 35 |
Item { |
| 36 |
id: internal |
| 37 |
|
| 38 |
// Note: The bindings below need to check whether headerConfig.contents |
| 39 |
// is valid in the "value", even when that is required in the Binding's "when" |
| 40 |
// property, to avoid TypeErrors while/after a page becomes (in)active. |
| 41 |
// |
| 42 |
// Note 2: contents.parent binding is made by PageHeadStyle. |
| 43 |
property bool hasParent: headerConfig.contents && |
| 44 |
headerConfig.contents.parent |
| 45 |
|
| 46 |
Binding { |
| 47 |
target: headerConfig.contents |
| 48 |
property: "visible" |
| 49 |
value: page.active |
| 50 |
when: headerConfig.contents |
| 51 |
} |
| 52 |
Binding { |
| 53 |
target: headerConfig.contents |
| 54 |
property: "anchors.verticalCenter" |
| 55 |
value: internal.hasParent ? headerConfig.contents.parent.verticalCenter : |
| 56 |
undefined |
| 57 |
when: headerConfig.contents |
| 58 |
} |
| 59 |
Binding { |
| 60 |
target: headerConfig.contents |
| 61 |
property: "anchors.left" |
| 62 |
value: internal.hasParent ? headerConfig.contents.parent.left : undefined |
| 63 |
when: headerConfig.contents |
| 64 |
} |
| 65 |
} |
| 66 |
} |