| 1 |
/* |
| 2 |
* Copyright (C) 2016 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 version 3 as |
| 6 |
* published by the Free Software Foundation. |
| 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 |
* Authored by: Florian Boucault <[email protected]> |
| 17 |
*/ |
| 18 |
import QtQuick 2.4 |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
|
| 21 |
Rectangle { |
| 22 |
id: settingsCard |
| 23 |
|
| 24 |
property string title |
| 25 |
property real margins: units.gu(2) |
| 26 |
default property alias contentItem: content.children |
| 27 |
|
| 28 |
width: parent.width |
| 29 |
height: content.height |
| 30 |
+ content.anchors.topMargin + content.anchors.bottomMargin |
| 31 |
color: theme.palette.normal.overlay |
| 32 |
|
| 33 |
Label { |
| 34 |
id: titleLabel |
| 35 |
anchors { |
| 36 |
top: parent.top |
| 37 |
left: parent.left |
| 38 |
right: parent.right |
| 39 |
topMargin: settingsCard.margins |
| 40 |
leftMargin: settingsCard.margins |
| 41 |
rightMargin: settingsCard.margins |
| 42 |
} |
| 43 |
text: settingsCard.title |
| 44 |
textSize: Label.Large |
| 45 |
elide: Text.ElideRight |
| 46 |
} |
| 47 |
|
| 48 |
Item { |
| 49 |
id: content |
| 50 |
anchors { |
| 51 |
top: parent.top |
| 52 |
left: parent.left |
| 53 |
right: parent.right |
| 54 |
leftMargin: settingsCard.margins |
| 55 |
rightMargin: settingsCard.margins |
| 56 |
topMargin: settingsCard.margins + titleLabel.height + units.gu(1) |
| 57 |
bottomMargin: settingsCard.margins |
| 58 |
} |
| 59 |
|
| 60 |
height: childrenRect.height |
| 61 |
} |
| 62 |
} |