mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-28 02:43:49 -06:00
qt: add ReadableGraphDisplay
This commit is contained in:
parent
ed84e8bde4
commit
9119d9a3f8
16
src/modules/interface/qt/widgets/ReadableGraphDisplay.cpp
Normal file
16
src/modules/interface/qt/widgets/ReadableGraphDisplay.cpp
Normal 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);
|
||||
}
|
17
src/modules/interface/qt/widgets/ReadableGraphDisplay.h
Normal file
17
src/modules/interface/qt/widgets/ReadableGraphDisplay.h
Normal 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;
|
||||
};
|
Loading…
Reference in New Issue
Block a user