aboutsummaryrefslogtreecommitdiff
path: root/examples/main.qml
blob: 0615a63bbfe4c2ae90886c6b2706a94d72d711b0 (plain)
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
import QtQuick 1.1
import QMenuModel 1.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem

Rectangle {
    id: main

    height: 800
    width: 480
    color: "#eeeeee"

    function loadMainMenu(menu) {
        mainMenu.model = menu
    }

    QDBusMenuModel {
        id: menuModel
        busType: 1
        busName: "com.ubuntu.networksettings"
        objectPath: "/com/ubuntu/networksettings"
        onStatusChanged: {
            console.log("Menu model status update: " + status)
        }
    }

    ListView {
        id: mainMenu
        anchors.fill: parent
        model: menuModel

        delegate: MenuFactory {
            width: parent.width
            menu: model
        }

        Component.onCompleted: {
            menuModel.start()
        }
    }
}