AnchorButtons.qml 4.05 KB
Newer Older
1 2 3 4 5 6 7 8
import Qt 4.6
import Bauhaus 1.0


QWidget {
    id: anchorButtons
    fixedHeight: 32

9 10 11
    function isBorderAnchored() {
        return anchorBackend.leftAnchored || anchorBackend.topAnchored || anchorBackend.rightAnchored || anchorBackend.bottomAnchored;
    }
12

13 14 15
    function fill() {
        anchorBackend.fill();
    }
16

17 18
    function breakLayout() {
        anchorBackend.resetLayout()
19 20 21 22 23
    }

    QPushButton {

        checkable: true
24
        fixedWidth: 31
25
		width: fixedWidth
26
        fixedHeight: 28
27
		height: fixedHeight
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
        styleSheetFile: "anchortop.css";

        checked: anchorBackend.topAnchored;
        onToggled: {
            if (checked) {
                anchorBackend.verticalCentered = false;
                anchorBackend.topAnchored = true;
            } else {
                anchorBackend.topAnchored = false;
            }
        }

    }

    QPushButton {

44
        x: 31
45
        checkable: true
46
        fixedWidth: 30
47
		width: fixedWidth
48
        fixedHeight: 28
49
		height: fixedHeight
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

        styleSheetFile: "anchorbottom.css";

        checked: anchorBackend.bottomAnchored;
        onToggled: {
            if (checked) {
                anchorBackend.verticalCentered = false;
                anchorBackend.bottomAnchored = true;
            } else {
                anchorBackend.bottomAnchored = false;
            }
        }

    }
    QPushButton {

66
        x: 61
67
        checkable: true
68
        fixedWidth: 30
69
		width: fixedWidth
70
        fixedHeight: 28
71
		height: fixedHeight
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

        styleSheetFile: "anchorleft.css";

        checked: anchorBackend.leftAnchored;
        onToggled: {
            if (checked) {
                    anchorBackend.horizontalCentered = false;
                    anchorBackend.leftAnchored = true;
                } else {
                    anchorBackend.leftAnchored = false;
                }
        }
    }

    QPushButton {

88
        x: 91
89
        checkable: true
90
        fixedWidth: 30
91
		width: fixedWidth
92
        fixedHeight: 28
93
		height: fixedHeight
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

        styleSheetFile: "anchorright.css";

        checked: anchorBackend.rightAnchored;
        onToggled: {
            if (checked) {
                    anchorBackend.horizontalCentered = false;
                    anchorBackend.rightAnchored = true;
                } else {
                    anchorBackend.rightAnchored = false;
                }
        }
    }

    QPushButton {
109
        x: 121
110
        checkable: true
111
        fixedWidth: 19
112
		width: fixedWidth
113
        fixedHeight: 28
114
		height: fixedHeight
115 116 117 118 119 120 121

        styleSheetFile: "anchorspacer.css";


    }

    QPushButton {
122 123 124
        x: 140
        fixedWidth: 30
        fixedHeight: 28
125
		height: fixedHeight
126 127 128 129 130 131 132

        styleSheetFile: "anchorfill.css";

        onReleased: fill();
    }

    QPushButton {
133
        x: 170
134
        checkable: true
135
        fixedWidth: 19
136
		width: fixedWidth
137
        fixedHeight: 28
138
		height: fixedHeight
139 140 141 142 143 144

        styleSheetFile: "anchorspacer.css";

    }

    QPushButton {
145
        x: 189
146
        checkable: true
147
        fixedWidth: 30
148
		width: fixedWidth
149
        fixedHeight: 28
150
		height: fixedHeight
151

152
		styleSheetFile: "anchorvertical.css";
153

154
        checked: anchorBackend.verticalCentered;
155 156 157 158
        onToggled: {
            if (checked) {
                    anchorBackend.leftAnchored = false;
                    anchorBackend.rightAnchored = false;
159
                    anchorBackend.verticalCentered = true;
160
            } else {
161
                    anchorBackend.verticalCentered = false;
162 163 164 165 166
            }
        }
    }

    QPushButton {
167
        x: 219
168
        checkable: true
169
        fixedWidth: 31
170
		width: fixedWidth
171
        fixedHeight: 28
172
		height: fixedHeight
173 174
        
		styleSheetFile: "anchorhorizontal.css";
175

176
        checked: anchorBackend.horizontalCentered;
177 178 179 180
        onToggled: {
            if (checked) {
                    anchorBackend.topAnchored = false;
                    anchorBackend.bottomAnchored = false;
181
                    anchorBackend.horizontalCentered = true;
182
            } else {
183
                    anchorBackend.horizontalCentered = false;
184 185 186 187 188
            }
        }
    }
}