summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-03 07:11:22 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-03 07:11:22 (GMT)
commitc46819349aa0ebc82b84ef8e153882c398f2d456 (patch)
tree87a8036b36e90f2d08b40710b82c626877f4d8ee
parentcff84cbca1f0fdfba99ebd2fab289d15355a2486 (diff)
Test dnd
-rw-r--r--webengineviewer/src/tests/testdndwebengine.cpp33
-rw-r--r--webengineviewer/src/tests/testdndwebengine.h17
2 files changed, 47 insertions, 3 deletions
diff --git a/webengineviewer/src/tests/testdndwebengine.cpp b/webengineviewer/src/tests/testdndwebengine.cpp
index d847a92..688d8a0 100644
--- a/webengineviewer/src/tests/testdndwebengine.cpp
+++ b/webengineviewer/src/tests/testdndwebengine.cpp
@@ -23,6 +23,7 @@
#include <QVBoxLayout>
#include <webengineview.h>
#include <QTextEdit>
+#include <QDebug>
TestDndWebEngine::TestDndWebEngine(QWidget *parent)
: QWidget(parent)
@@ -35,7 +36,7 @@ TestDndWebEngine::TestDndWebEngine(QWidget *parent)
pageView->load(QUrl(QStringLiteral("http://www.planetkde.org")));
layout->addWidget(pageView);
- webEngineView = new QWebEngineView(this);
+ webEngineView = new WebEngineViewBase(this);
webEngineView->load(QUrl(QStringLiteral("http://www.kde.org")));
layout->addWidget(webEngineView);
@@ -57,3 +58,33 @@ int main(int argc, char *argv[])
const int ret = app.exec();
return ret;
}
+
+WebEngineViewBase::WebEngineViewBase(QWidget *parent)
+ : QWebEngineView(parent)
+{
+ qDebug() << "WebEngineViewBase::WebEngineViewBase(QWidget *parent)"<<this;
+}
+
+void WebEngineViewBase::dragEnterEvent(QDragEnterEvent *e)
+{
+ qDebug()<<" void WebEngineViewBase::dragEnterEvent(QDragEnterEvent *e)";
+ QWebEngineView::dragEnterEvent(e);
+}
+
+void WebEngineViewBase::dragLeaveEvent(QDragLeaveEvent *e)
+{
+ qDebug()<<" void WebEngineViewBase::dragLeaveEvent(QDragEnterEvent *e)";
+ QWebEngineView::dragLeaveEvent(e);
+}
+
+void WebEngineViewBase::dragMoveEvent(QDragMoveEvent *e)
+{
+ qDebug() << "void WebEngineViewBase::dragMoveEvent(QDragMoveEvent *e)";
+ QWebEngineView::dragMoveEvent(e);
+}
+
+void WebEngineViewBase::dropEvent(QDropEvent *e)
+{
+ qDebug()<<" void WebEngineViewBase::dropEvent(QDropEvent *e)";
+ QWebEngineView::dropEvent(e);
+}
diff --git a/webengineviewer/src/tests/testdndwebengine.h b/webengineviewer/src/tests/testdndwebengine.h
index c5c1fef..5eb4cc3 100644
--- a/webengineviewer/src/tests/testdndwebengine.h
+++ b/webengineviewer/src/tests/testdndwebengine.h
@@ -20,13 +20,26 @@
#ifndef TestDndWebEngine_H
#define TestDndWebEngine_H
+#include <QWebEngineView>
#include <QWidget>
namespace WebEngineViewer
{
class WebEngineView;
}
-class QWebEngineView;
+
+class WebEngineViewBase : public QWebEngineView
+{
+ Q_OBJECT
+public:
+ explicit WebEngineViewBase(QWidget* parent = Q_NULLPTR);
+protected:
+ void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+};
+
class TestDndWebEngine : public QWidget
{
Q_OBJECT
@@ -35,7 +48,7 @@ public:
~TestDndWebEngine();
private:
WebEngineViewer::WebEngineView *pageView;
- QWebEngineView *webEngineView;
+ WebEngineViewBase *webEngineView;
};
#endif // TestDndWebEngine_H