qt: add ReadableGraphDisplay

This commit is contained in:
Jussi Kuokkanen 2019-11-17 15:13:47 +02:00
parent ed84e8bde4
commit 9119d9a3f8
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#include "ReadableGraphDisplay.h"
ReadableGraphDisplay::ReadableGraphDisplay(QWidget *parent) : QGraphicsView(new QGraphicsScene, parent) {
m_chart = new QChart;
m_chart->createDefaultAxes();
scene()->addItem(m_chart);
}
bool ReadableGraphDisplay::event(QEvent *event) {
if (event->type() == QEvent::Leave) {
qDebug() << "leave";
return true;
}
return QAbstractScrollArea::event(event);
}

View File

@ -0,0 +1,17 @@
#pragma once
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QtCharts/QChart>
#include <QDebug>
using namespace QtCharts;
class ReadableGraphDisplay : public QGraphicsView {
public:
ReadableGraphDisplay(QWidget *parent = nullptr);
protected:
bool event(QEvent *event);
private:
QChart *m_chart;
};