~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-2202

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Settings/Menus/BaseLayoutMenu.qml

  • Committer: Bileto Bot
  • Date: 2016-10-24 11:32:00 UTC
  • mfrom: (146.3.110 slots-layout)
  • Revision ID: ci-train-bot@canonical.com-20161024113200-85dvkl9m1o0msi5i
* Menus: rewrite components using ListItemLayout's and SlotsLayout's
* Bump revision to 0.10, as per Components removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 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 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
 * Author: Marco Trevisan <marco.trevisan@canonical.com>
 
17
 */
 
18
 
 
19
import QtQuick 2.4
 
20
import Ubuntu.Components 1.3
 
21
 
 
22
BaseMenu {
 
23
    id: menu
 
24
 
 
25
    property string text
 
26
    property alias layout: layoutItem
 
27
    property alias title: layoutItem.title
 
28
    property alias subtitle: layoutItem.subtitle
 
29
    property alias summary: layoutItem.summary
 
30
    property alias slots: layoutItem.children
 
31
 
 
32
    // These fields are for retro-compatibility with ListItem.Empty based MenuItems
 
33
    property alias trailingComponent: trailingComponentLoader.sourceComponent
 
34
    property alias trailingComponentItem: trailingComponentLoader.item
 
35
    property alias component: menu.trailingComponent
 
36
 
 
37
    implicitHeight: layoutItem.height + (divider.visible ? divider.height : 0)
 
38
 
 
39
    ListItemLayout {
 
40
        id: layoutItem
 
41
        objectName: "menuLayoutItem"
 
42
        title.text: menu.text
 
43
        title.color: menu.foregroundColor
 
44
 
 
45
        Loader {
 
46
            id: trailingComponentLoader
 
47
            asynchronous: false
 
48
            visible: status == Loader.Ready
 
49
            SlotsLayout.position: SlotsLayout.Trailing
 
50
        }
 
51
    }
 
52
}