comparison examples/draganddrop/dropsite/dropsitewindow.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 7a3c43424dca
children a032df77b6ab
comparison
equal deleted inserted replaced
349:925386e0e780 350:31520b2c0b3c
39 ** 39 **
40 ****************************************************************************/ 40 ****************************************************************************/
41 41
42 module dropsitewindow; 42 module dropsitewindow;
43 43
44 import std.string; 44 import std.string : format, strip, toupper;
45 45
46 import qt.gui.QWidget; 46 import qt.gui.QWidget;
47 import qt.gui.QLabel; 47 import qt.gui.QLabel;
48 import qt.gui.QTableWidget; 48 import qt.gui.QTableWidget;
49 import qt.gui.QPushButton; 49 import qt.gui.QPushButton;
54 54
55 55
56 class DropSiteWindow : public QWidget 56 class DropSiteWindow : public QWidget
57 { 57 {
58 public: 58 public:
59 59
60 this() 60 this()
61 { 61 {
62 abstractLabel = new QLabel(tr("This example accepts drags from other " 62 abstractLabel = new QLabel(tr("This example accepts drags from other "
63 "applications and displays the MIME types " 63 "applications and displays the MIME types "
64 "provided by the drag object.")); 64 "provided by the drag object."));
65 65
66 abstractLabel.setWordWrap(true); 66 abstractLabel.setWordWrap(true);
67 abstractLabel.adjustSize(); 67 abstractLabel.adjustSize();
68 68
69 dropArea = new DropArea; 69 dropArea = new DropArea;
70 connect(dropArea, "changed", this, "updateFormatsTable"); 70 connect(dropArea, "changed", this, "updateFormatsTable");
123 text ~= url ~ " "; 123 text ~= url ~ " ";
124 } 124 }
125 } else { 125 } else {
126 QByteArray data = mimeData.data(format); 126 QByteArray data = mimeData.data(format);
127 for (int i = 0; i < data.size() && i < 32; ++i) { 127 for (int i = 0; i < data.size() && i < 32; ++i) {
128 string hex = toupper(std.string.format("%x", data.at(i))); 128 string hex = toupper(std.string.format("%x", data.at(i)));
129 text ~= hex ~ " "; 129 text ~= hex ~ " ";
130 } 130 }
131 } 131 }
132 132
133 int row = formatsTable.rowCount(); 133 int row = formatsTable.rowCount();
146 QTableWidget formatsTable; 146 QTableWidget formatsTable;
147 147
148 QPushButton clearButton; 148 QPushButton clearButton;
149 QPushButton quitButton; 149 QPushButton quitButton;
150 QDialogButtonBox buttonBox; 150 QDialogButtonBox buttonBox;
151 151
152 mixin Q_OBJECT; 152 mixin Q_OBJECT;
153 } 153 }