comparison examples/dialogs/standarddialogs/dialog.d @ 350:31520b2c0b3c

Removed dependency on parent trait and stringof
author Max Samukha <maxter@spambox.com>
date Thu, 20 May 2010 15:49:08 +0300
parents 4e31cbd9e20c
children
comparison
equal deleted inserted replaced
349:925386e0e780 350:31520b2c0b3c
37 ** contact the sales department at qt-sales@nokia.com. 37 ** contact the sales department at qt-sales@nokia.com.
38 ** $QT_END_LICENSE$ 38 ** $QT_END_LICENSE$
39 ** 39 **
40 ****************************************************************************/ 40 ****************************************************************************/
41 module dialog; 41 module dialog;
42
43 42
44 import qt.gui.QDialog; 43 import qt.gui.QDialog;
45 import qt.gui.QCheckBox; 44 import qt.gui.QCheckBox;
46 import qt.gui.QLabel; 45 import qt.gui.QLabel;
47 import qt.gui.QMessageBox; 46 import qt.gui.QMessageBox;
53 import qt.gui.QColorDialog; 52 import qt.gui.QColorDialog;
54 import qt.gui.QFontDialog; 53 import qt.gui.QFontDialog;
55 import qt.gui.QFileDialog; 54 import qt.gui.QFileDialog;
56 import qt.core.QFile; 55 import qt.core.QFile;
57 56
58 import std.string; 57 import std.string : format, join;
59
60 58
61 string MESSAGE = tr("<p>Message boxes have a caption, a text, " 59 string MESSAGE = tr("<p>Message boxes have a caption, a text, "
62 "and any number of buttons, each with standard or custom texts." 60 "and any number of buttons, each with standard or custom texts."
63 "<p>Click a button to close the message box. Pressing the Esc button " 61 "<p>Click a button to close the message box. Pressing the Esc button "
64 "will activate the detected escape button (if any)."); 62 "will activate the detected escape button (if any).");
152 connect(errorButton, "clicked", this, "errorMessage"); 150 connect(errorButton, "clicked", this, "errorMessage");
153 151
154 native = new QCheckBox(this); 152 native = new QCheckBox(this);
155 native.setText("Use native file dialog."); 153 native.setText("Use native file dialog.");
156 native.setChecked(true); 154 native.setChecked(true);
157 155
158 version(windows) {} else 156 version(windows) {} else
159 { 157 {
160 version(mac) {} else 158 version(mac) {} else
161 { 159 {
162 native.hide(); 160 native.hide();
207 void slot_setInteger() 205 void slot_setInteger()
208 { 206 {
209 bool ok; 207 bool ok;
210 int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok); 208 int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok);
211 if (ok) 209 if (ok)
212 integerLabel.setText(format("%d", i)); 210 integerLabel.setText(format("%d", i));
213 } 211 }
214 212
215 void slot_setDouble() 213 void slot_setDouble()
216 { 214 {
217 bool ok; 215 bool ok;
218 double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"), 216 double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"),
219 tr("Amount:"), 37.56, -10000, 10000, 2, ok); 217 tr("Amount:"), 37.56, -10000, 10000, 2, ok);
220 if (ok) 218 if (ok)
221 doubleLabel.setText(format("%g", d)); 219 doubleLabel.setText(format("%g", d));
222 } 220 }
223 221
224 void slot_setItem() 222 void slot_setItem()
225 { 223 {
226 string[] items = [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")]; 224 string[] items = [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")];
405 QLabel warningLabel; 403 QLabel warningLabel;
406 QLabel errorLabel; 404 QLabel errorLabel;
407 QErrorMessage errorMessageDialog; 405 QErrorMessage errorMessageDialog;
408 406
409 string openFilesPath; 407 string openFilesPath;
410 408
411 mixin Q_OBJECT; 409 mixin Q_OBJECT;
412 } 410 }