qt: update ReadableDisplay

This commit is contained in:
Jussi Kuokkanen 2019-11-17 15:17:39 +02:00
parent 716545f0a1
commit 5b9c0b2cc4
2 changed files with 29 additions and 1 deletions

View File

@ -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();
}

View File

@ -1,8 +1,19 @@
#pragma once
#include <QWidget>
#include <QMimeData>
#include <QDragEnterEvent>
#include <QVBoxLayout>
#include <ReadableData.h>
#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;
};