From 5b9c0b2cc44dafcdc1ac5baeb2520ed62724a1b3 Mon Sep 17 00:00:00 2001 From: Jussi Kuokkanen Date: Sun, 17 Nov 2019 15:17:39 +0200 Subject: [PATCH] qt: update ReadableDisplay --- .../interface/qt/widgets/ReadableDisplay.cpp | 19 ++++++++++++++++++- .../interface/qt/widgets/ReadableDisplay.h | 11 +++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/modules/interface/qt/widgets/ReadableDisplay.cpp b/src/modules/interface/qt/widgets/ReadableDisplay.cpp index bc4e445..797a20f 100644 --- a/src/modules/interface/qt/widgets/ReadableDisplay.cpp +++ b/src/modules/interface/qt/widgets/ReadableDisplay.cpp @@ -1,4 +1,21 @@ -#include "ReadableDisplay.h" + #include "ReadableDisplay.h" ReadableDisplay::ReadableDisplay(QWidget *parent) : QWidget(parent) { + setAcceptDrops(true); + + m_displayWidgetLayout = new QVBoxLayout; + + m_displayWidgetLayout->addWidget(new ReadableGraphDisplay); + + setLayout(m_displayWidgetLayout); +} + +void ReadableDisplay::dropEvent(QDropEvent *event) { +} + +void ReadableDisplay::dragEnterEvent(QDragEnterEvent *event) { + if (!event->mimeData()->hasFormat(ReadableData::mimeType())) { + return; + } + event->accept(); } diff --git a/src/modules/interface/qt/widgets/ReadableDisplay.h b/src/modules/interface/qt/widgets/ReadableDisplay.h index 45e5236..1d28c77 100644 --- a/src/modules/interface/qt/widgets/ReadableDisplay.h +++ b/src/modules/interface/qt/widgets/ReadableDisplay.h @@ -1,8 +1,19 @@ #pragma once #include +#include +#include +#include + +#include +#include "ReadableGraphDisplay.h" class ReadableDisplay : public QWidget { public: ReadableDisplay(QWidget *parent = nullptr); +protected: + void dragEnterEvent(QDragEnterEvent *event) override; + void dropEvent(QDropEvent *event) override; +private: + QVBoxLayout *m_displayWidgetLayout; };