summaryrefslogtreecommitdiffstats
path: root/src/gui/doc
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-08-31 13:54:04 +0200
committerPaul Wicking <paul.wicking@qt.io>2020-09-01 06:13:12 +0200
commit4dd53a40aaf693ab31a18b1c1c423ca8147e044f (patch)
tree13c3978bd529f8a3661d11aba593f37ecd42114e /src/gui/doc
parent88e3bdb6e689ab6a585b7c0742de33e09b584460 (diff)
Doc: Compile dropevents snippets
Done-with: Nico Vertriest <nico.vertriest@qt.io> Task-number: QTBUG-81486 Change-Id: I8d2eebcd82f47c500a215e310b5828f9b7e303c6 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/gui/doc')
-rw-r--r--src/gui/doc/snippets/dropevents/dropevents.pro9
-rw-r--r--src/gui/doc/snippets/dropevents/window.cpp27
-rw-r--r--src/gui/doc/snippets/snippets.pro1
3 files changed, 32 insertions, 5 deletions
diff --git a/src/gui/doc/snippets/dropevents/dropevents.pro b/src/gui/doc/snippets/dropevents/dropevents.pro
index 6283406f25..54c3ceeb5b 100644
--- a/src/gui/doc/snippets/dropevents/dropevents.pro
+++ b/src/gui/doc/snippets/dropevents/dropevents.pro
@@ -1,3 +1,6 @@
-HEADERS = window.h
-SOURCES = main.cpp \
- window.cpp
+TEMPLATE = lib
+TARGET = dropevents_snippets
+QT += core gui widgets
+
+SOURCES = \
+ window.cpp
diff --git a/src/gui/doc/snippets/dropevents/window.cpp b/src/gui/doc/snippets/dropevents/window.cpp
index c3445bcc75..a62b656b64 100644
--- a/src/gui/doc/snippets/dropevents/window.cpp
+++ b/src/gui/doc/snippets/dropevents/window.cpp
@@ -47,10 +47,31 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include <QComboBox>
+#include <QDragEnterEvent>
+#include <QLabel>
+#include <QMimeData>
+#include <QTextBrowser>
+#include <QVBoxLayout>
+#include <QWidget>
-#include <QtGui>
+namespace dropevents {
+class Window : public QWidget
+{
+
+public:
+ explicit Window(QWidget *parent = nullptr);
-#include "window.h"
+protected:
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+
+private:
+ QComboBox *mimeTypeCombo = nullptr;
+ QTextBrowser *textBrowser = nullptr;
+ QString oldText;
+ QStringList oldMimeTypes;
+};
//! [0]
Window::Window(QWidget *parent)
@@ -95,3 +116,5 @@ void Window::dropEvent(QDropEvent *event)
event->acceptProposedAction();
}
//! [4]
+
+} // dropevents
diff --git a/src/gui/doc/snippets/snippets.pro b/src/gui/doc/snippets/snippets.pro
index 079ffa7918..ce8ccd1577 100644
--- a/src/gui/doc/snippets/snippets.pro
+++ b/src/gui/doc/snippets/snippets.pro
@@ -8,6 +8,7 @@ contains(QT_BUILD_PARTS, tests) {
code \
draganddrop \
droparea \
+ dropevents \
qfontdatabase \
textblock-formats \
textblock-fragments \