Ubuntu Pastebin

Paste from micha at Thu, 21 May 2015 16:52:56 +0000

Download as text
 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
import QtQuick 2.2
import GSettings 1.0

Item {
    width: 500
    height: 500

    GSettings {
        id: settings
        schema.id: "com.canonical.Unity8"
    }

    Loader {
        anchors.fill: parent
        sourceComponent: settings.usageMode == "Windowed" ? comp1 : comp2
    }

    Component {
        id: comp1
        Rectangle { color: "green"; Component.onCompleted: print("comp1 created"); Component.onDestruction: print("comp1 destroyed") }
    }
    Component {
        id: comp2
        Rectangle { color: "red"; Component.onCompleted: print("comp2 created"); Component.onDestruction: print("comp2 destroyed") }
    }
}
Download as text