File: WindowModelDebugView.qml

package info (click to toggle)
qtmir 0.8.0~git20230223.bd21224-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,568 kB
  • sloc: cpp: 22,847; python: 304; xml: 271; ansic: 87; makefile: 20; sh: 12
file content (72 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import QtQuick 2.0
import QtMir.Application 0.1

Column {
    id: root
    width: childrenRect.width
    height: childrenRect.height
    focus: false

    property alias model: repeater.model

    function stateString(state) {
        switch(state) {
        case Mir.HiddenState:         return "Hidden"
        case Mir.RestoredState:       return "Restored"
        case Mir.MinimizedState:      return "Minimized"
        case Mir.MaximizedState:      return "Maximized"
        case Mir.VertMaximizedState:  return "VertMax"
        case Mir.FullscreenState:     return "Fullscreen"
        case Mir.HorizMaximizedState: return "HorizMax"
        case Mir.UnknownState:        return "Unknown"
        }
        return "Invalid"
    }
    function typeString(type) {
        switch(type) {
        case Mir.UnknownType:   return "Unknown"
        case Mir.NormalType:        return "Normal"
        case Mir.UtilityType:       return "Utility"
        case Mir.DialogType:        return "Dialog"
        case Mir.GlossType:         return "Gloss"
        case Mir.FreeStyleType:     return "FreeStyle"
        case Mir.MenuType:          return "Menu"
        case Mir.InputMethodType:   return "InputMethod"
        case Mir.SatelliteType:     return "Satellite"
        case Mir.TipType:           return "Tip"
        }
        return "Invalid"
    }

    function geometryString(surface) {
        return surface.position.x + "," + surface.position.y + " " + surface.size.width + "x" + surface.size.height
    }


    Text {
        text: "Index\t\Name\tVisible\tState\tType\tGeometry"
        height: (visible) ? implicitHeight : 0
        visible: repeater.count > 0
        color: "white"

        Rectangle {
            anchors.fill: parent
            color: "blue"
            z: -1
        }
    }
    Repeater {
        id: repeater
        delegate: Text {
            text: index + "\t" + surface.name + "\t" + surface.visible + "\t"
                  + stateString(surface.state) + "\t" +  typeString(surface.type) + "\t" + geometryString(surface)
            font.bold: surface.focused

            Rectangle {
                anchors.fill: parent
                color: (index % 2) ? "white" : "lightblue"
                z: -1
            }
        }
    }
}