Extended.qml 7.3 KB
Newer Older
1
import Qt 4.7
2 3 4
import Bauhaus 1.0

GroupBox {
5
    caption: qsTr("Effect")
6
    id: extended;
7 8 9 10
    maximumHeight: 260;

    layout: VerticalLayout{

11 12
        property variant effect: backendValues.effect
        property variant complexNode: effect.complexNode
13 14 15 16 17 18 19 20 21

        QWidget  {
            maximumHeight: 40;
            layout: HorizontalLayout {
                Label {
                    text: "Effect ";
                }
                QComboBox {
                    enabled: isBaseState;
22 23
                    property variant type: backendValues.effect.complexNode.type
                    property variant dirty;
24 25
                    id: effectComboBox;
                    items : { [
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
                            "None",
                            "Blur",
                            "Opacity",
                            "Colorize",
                            "DropShadow"
                            ] }

                            onCurrentTextChanged: {

                                if (dirty) //avoid recursion;
                                return;
                                if (currentText == "")

                                if (backendValues.effect.complexNode.exists)
                                backendValues.effect.complexNode.remove();
                                if (currentText == "None") {
                                    ;
                                    } else if (backendValues.effect.complexNode != null) {
                                    backendValues.effect.complexNode.add("Qt/" + currentText);
                                    }
                            }

                            onTypeChanged: {
                                dirty = true;
                                if (backendValues.effect.complexNode.exists)
                                currentText = backendValues.effect.complexNode.type;
                                else
                                currentText = "None";
                                dirty = false;
                            }
56 57
                }
                QWidget {
58 59
                    fixedWidth: 100
                }
60
            }
61 62
            }// QWidget

63
            property variant properties: complexNode == null ? null : complexNode.properties
64 65 66 67 68 69 70 71 72 73 74 75

            QWidget {
                minimumHeight: 20;
                layout: QVBoxLayout {

                    QWidget {
                        visible: effectComboBox.currentText == "Blur";
                        layout: QVBoxLayout {
                            topMargin: 12;
                            IntEditor {
                                id: blurRadius;
                                backendValue: backendValues.effect.complexNode.exists ? backendValues.effect.complexNode.properties.blurRadius : null;
76
                                caption: qsTr("Blur Radius:")
77 78 79 80 81 82
                                baseStateFlag: isBaseState;

                                step: 1;
                                minimumValue: 0;
                                maximumValue: 20;
                            }
83 84
                        }
                    }
85

86 87 88 89
                    QWidget {
                        visible: effectComboBox.currentText == "Opacity";
                        layout: QVBoxLayout {
                            DoubleSpinBox {
90
                                id: opcacityEffectSpinBox;
91 92 93 94 95 96
                                backendValue: backendValues.effect.complexNode.exists ? backendValues.effect.complexNode.properties.opacity : null;
                                minimum: 0;
                                maximum: 1;
                                singleStep: 0.1;
                                baseStateFlag: isBaseState;
                            }
97 98 99
                        }
                    }

100 101 102
                    QWidget {
                        visible: effectComboBox.currentText == "Colorize";
                        layout: QVBoxLayout {
103

104
                            property variant colorProp: properties == null ? null : properties.color
105 106


107 108 109
                            ColorLabel {
                                text: "    Color"
                            }
110

111
                            ColorGroupBox {
112

113
                                finished: finishedNotify
114

115 116
                                backendColor: properties.color
                            }
117

118 119
                        }
                    }
120

121 122 123 124 125 126 127
                    QWidget {
                        visible: effectComboBox.currentText == "Pixelize";
                        layout: QVBoxLayout {
                            topMargin: 12;
                            IntEditor {
                                id: pixelSize;
                                backendValue: backendValues.effect.complexNode.exists ? backendValues.effect.complexNode.properties.pixelSize : null;
128
                                caption: qsTr("Pixel Size:")
129 130 131 132 133 134
                                baseStateFlag: isBaseState;

                                step: 1;
                                minimumValue: 0;
                                maximumValue: 20;
                            }
135
                        }
136
                    }
137

138 139 140
                    QWidget {
                        visible: effectComboBox.currentText == "DropShadow";
                        layout: QVBoxLayout {
141

142 143 144 145
                            topMargin: 12;
                            IntEditor {
                                id: blurRadiusShadow;
                                backendValue: backendValues.effect.complexNode.exists ? backendValues.effect.complexNode.properties.blurRadius : null;
146
                                caption: qsTr("Blur Radius:")
147
                                baseStateFlag: isBaseState;
148

149 150 151 152
                                step: 1;
                                minimumValue: 0;
                                maximumValue: 20;
                            }
153

154

155 156 157
                            ColorLabel {
                                text: "    Color"
                            }
158

159
                            ColorGroupBox {
160

161 162 163 164 165 166 167 168
                                finished: finishedNotify

                                backendColor: properties.color
                            }

                            IntEditor {
                                id: xOffset;
                                backendValue: backendValues.effect.complexNode.exists ? backendValues.effect.complexNode.properties.xOffset : null;
169
                                caption: qsTr("x Offset:     ")
170 171 172 173 174 175
                                baseStateFlag: isBaseState;

                                step: 1;
                                minimumValue: 0;
                                maximumValue: 20;
                            }
176

177 178 179
                            IntEditor {
                                id: yOffset;
                                backendValue: backendValues.effect.complexNode.exists ? backendValues.effect.complexNode.properties.yOffset : null;
180
                                caption: qsTr("y Offset:     ")
181
                                baseStateFlag: isBaseState;
182

183 184 185 186
                                step: 1;
                                minimumValue: 0;
                                maximumValue: 20;
                            }
187 188 189
                        }
                    }
                }
190
            }
191 192
            } //QVBoxLayout
            } //GroupBox