Mercurial > projects > qtd
comparison examples/draganddrop/dropsite/droparea.d @ 323:7a3c43424dca signals
make all examples compile with new signals/slots
author | eldar_ins@eldar-laptop |
---|---|
date | Mon, 28 Dec 2009 16:28:55 +0500 |
parents | 1f6923c8cba0 |
children | a032df77b6ab |
comparison
equal
deleted
inserted
replaced
322:7c2cf27391c4 | 323:7a3c43424dca |
---|---|
56 setAcceptDrops(true); | 56 setAcceptDrops(true); |
57 setAutoFillBackground(true); | 57 setAutoFillBackground(true); |
58 clearArea(); | 58 clearArea(); |
59 } | 59 } |
60 | 60 |
61 void clearArea() | 61 void slot_clearArea() |
62 { | 62 { |
63 setText(tr("<drop content>")); | 63 setText(tr("<drop content>")); |
64 setBackgroundRole(QPalette.Dark); | 64 setBackgroundRole(QPalette.Dark); |
65 | 65 |
66 changed(null); | 66 changed(null); |
67 } | 67 } |
68 | 68 |
69 mixin Signal!("changed", QMimeData); | 69 final void signal_changed(QMimeData); |
70 | 70 |
71 protected: | 71 protected: |
72 | |
73 void dragEnterEvent(QDragEnterEvent event) | 72 void dragEnterEvent(QDragEnterEvent event) |
74 { | 73 { |
75 setText(tr("<drop content>")); | 74 setText(tr("<drop content>")); |
76 setBackgroundRole(QPalette.Highlight); | 75 setBackgroundRole(QPalette.Highlight); |
77 | 76 |
101 setTextFormat(Qt.RichText); | 100 setTextFormat(Qt.RichText); |
102 } else if (mimeData.hasText()) { | 101 } else if (mimeData.hasText()) { |
103 setText(mimeData.text()); | 102 setText(mimeData.text()); |
104 setTextFormat(Qt.PlainText); | 103 setTextFormat(Qt.PlainText); |
105 } else if (mimeData.hasUrls()) { | 104 } else if (mimeData.hasUrls()) { |
106 QUrl[] urlList = mimeData.urls(); | 105 auto urlList = mimeData.urls(); |
107 string text; | 106 string text; |
108 for (int i = 0; i < urlList.length && i < 32; ++i) { | 107 for (int i = 0; i < urlList.length && i < 32; ++i) { |
109 text ~= urlList[i].path() ~ "\n"; | 108 text ~= urlList[i].path() ~ "\n"; |
110 } | 109 } |
111 setText(text); | 110 setText(text); |
117 event.acceptProposedAction(); | 116 event.acceptProposedAction(); |
118 } | 117 } |
119 | 118 |
120 private: | 119 private: |
121 QLabel label; | 120 QLabel label; |
121 | |
122 mixin Q_OBJECT; | |
122 } | 123 } |
123 | 124 |