comparison examples/layouts/dynamiclayouts/dialog.d @ 108:9fa74f0e3fb6

uniform indention
author mandel
date Sun, 31 May 2009 09:46:41 +0000
parents 236401001115
children 256ab6cb8e85
comparison
equal deleted inserted replaced
107:23e208cef962 108:9fa74f0e3fb6
54 import qt.gui.QProgressBar; 54 import qt.gui.QProgressBar;
55 55
56 56
57 class Dialog : public QDialog 57 class Dialog : public QDialog
58 { 58 {
59
60 public: 59 public:
61 60
62 this(QWidget parent = null) 61 this(QWidget parent = null)
63 { 62 {
64 super(parent); 63 super(parent);
114 113
115 foreach (QWidget widget; rotableWidgets) 114 foreach (QWidget widget; rotableWidgets)
116 rotableLayout.removeWidget(widget); 115 rotableLayout.removeWidget(widget);
117 116
118 rotableWidgets = rotableWidgets[1..$] ~ rotableWidgets[0]; 117 rotableWidgets = rotableWidgets[1..$] ~ rotableWidgets[0];
119 118
120 int n = rotableWidgets.length; 119 int n = rotableWidgets.length;
121 for (int i = 0; i < n / 2; ++i) { 120 for (int i = 0; i < n / 2; ++i) {
122 rotableLayout.addWidget(rotableWidgets[n - i - 1], 0, i); 121 rotableLayout.addWidget(rotableWidgets[n - i - 1], 0, i);
123 rotableLayout.addWidget(rotableWidgets[i], 1, i); 122 rotableLayout.addWidget(rotableWidgets[i], 1, i);
124 } 123 }
134 133
135 void createRotableGroupBox() 134 void createRotableGroupBox()
136 { 135 {
137 rotableGroupBox = new QGroupBox(tr("Rotable Widgets")); 136 rotableGroupBox = new QGroupBox(tr("Rotable Widgets"));
138 137
139 a0 = new QSpinBox; 138 auto a0 = new QSpinBox;
140 a1 = new QSlider; 139 auto a1 = new QSlider;
141 a2 = new QDial; 140 auto a2 = new QDial;
142 a3 = new QProgressBar; 141 auto a3 = new QProgressBar;
143 142
144 rotableWidgets ~= a0; 143 rotableWidgets ~= a0;
145 rotableWidgets ~= a1; 144 rotableWidgets ~= a1;
146 rotableWidgets ~= a2; 145 rotableWidgets ~= a2;
147 rotableWidgets ~= a3; 146 rotableWidgets ~= a3;
148 147
149 a0.valueChanged.connect(&a1.setValue); 148 a0.valueChanged.connect(&a1.setValue);
150 a1.valueChanged.connect(&a2.setValue); 149 a1.valueChanged.connect(&a2.setValue);
151 a2.valueChanged.connect(&a3.setValue); 150 a2.valueChanged.connect(&a3.setValue);
152 a3.valueChanged.connect(&a0.setValue); 151 a3.valueChanged.connect(&a0.setValue);
153 152
154 /* 153 /*
155 int n = rotableWidgets.length; 154 int n = rotableWidgets.length;
156 for (int i = 0; i < n; ++i) { 155 for (int i = 0; i < n; ++i) {
157 rotableWidgets[i].valueChanged.connect(&rotableWidgets[(i + 1) % n].setValue); 156 rotableWidgets[i].valueChanged.connect(&rotableWidgets[(i + 1) % n].setValue);
158 }*/ 157 }*/
159 158
196 } 195 }
197 196
198 QGroupBox rotableGroupBox; 197 QGroupBox rotableGroupBox;
199 QWidget[] rotableWidgets; 198 QWidget[] rotableWidgets;
200 199
201 // qtd
202 QSpinBox a0;
203 QSlider a1;
204 QDial a2;
205 QProgressBar a3;
206
207 QGroupBox optionsGroupBox; 200 QGroupBox optionsGroupBox;
208 QLabel buttonsOrientationLabel; 201 QLabel buttonsOrientationLabel;
209 QComboBox buttonsOrientationComboBox; 202 QComboBox buttonsOrientationComboBox;
210 203
211 QDialogButtonBox buttonBox; 204 QDialogButtonBox buttonBox;