~dandrader/qtmir/surfaceDrawn

« back to all changes in this revision

Viewing changes to demos/qml-demo-shell/qml-demo-shell.qml

  • Committer: CI Train Bot
  • Author(s): Gerry Boland, Michał Sawicz, Nick Dedekind
  • Date: 2016-04-29 20:04:51 UTC
  • mfrom: (434.5.64 set-display-config)
  • Revision ID: ci-train-bot@canonical.com-20160429200451-v0bjc4pcypynt83b
Enhance ScreenController & the DisplayConfigurationPolicy to implement dynamic grid units.

- Rename ScreenController to ScreenModel, as it just reflects current screen state, does not offer means to configure it
- ScreenController can update state of existing Screens, based on Mir DisplayConfiguration changes.
- Expand Screen to include scale & form factor properties, with getter/notifier in NativeInterface. This enables the dynamic grid units in the shell
- Add a Unity.Screens qml module to give QML better information about connected screens, and allow basic reconfiguring.
- Implement a basic display configuration policy to set suitable scale and form factor on an external display (needed for dynamic grid units) Fixes: #1573532
Approved by: Unity8 CI Bot, Daniel d'Andrada

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import QtQuick 2.3
2
 
import QtQuick.Window 2.2 as QQW
3
2
import Unity.Screens 0.1
4
3
 
5
4
Instantiator {
8
7
    property var screens: Screens{}
9
8
 
10
9
    model: screens
11
 
    QQW.Window {
 
10
    ScreenWindow {
12
11
        id: window
13
12
        visible: true
 
13
        screen: model.screen
14
14
        Shell{ anchors.fill: parent }
15
15
        Component.onCompleted: {
16
 
            print("HEY", screen, screen.geometry, outputType, Screens.HDMIA)
 
16
            print("Window created for Screen", screen, screen.geometry, outputType, Screens.HDMIA, screen.devicePixelRatio)
 
17
        }
 
18
        Component.onDestruction: {
 
19
            print("Window destroyed")
 
20
        }
 
21
        onScaleChanged: print("NOTICE: scale changed for", model.screen, "to", scale);
 
22
        onFormFactorChanged: print("NOTICE: form factor changed for", model.screen, "to", formFactor)
 
23
        Button {
 
24
            anchors { left: parent.left; bottom: parent.bottom }
 
25
            height: 100
 
26
            width: parent.width / 2
 
27
            text: "Scale up"
 
28
            onClicked: window.setScaleAndFormFactor(window.scale + 0.2, Screens.FormFactorMonitor)
 
29
        }
 
30
        Button {
 
31
            anchors { right: parent.right; bottom: parent.bottom }
 
32
            height: 100
 
33
            width: parent.width / 2
 
34
            text: "Scale down"
 
35
            onClicked: window.setScaleAndFormFactor(window.scale - 0.2, Screens.FormFactorTablet)
17
36
        }
18
37
    }
19
38
}