Added first project implementation

This commit is contained in:
Yury Shuvakin
2024-01-22 18:45:09 +09:00
parent 065decd584
commit 9e957f29fe
12 changed files with 893 additions and 0 deletions

22
InteractiveChartView.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include "InteractiveChartView.h"
void InteractiveChartView::wheelEvent(QWheelEvent* event)
{
qreal factor;
if (event->delta() > 0)
factor = 2.0;
else
factor = 0.5;
QRectF r = QRectF(chart()->plotArea().left(),
chart()->plotArea().top(),
chart()->plotArea().width() / factor,
chart()->plotArea().height() / factor);
QPointF mousePos = mapFromGlobal(QCursor::pos());
r.moveCenter(mousePos);
chart()->zoomIn(r);
QPointF delta = chart()->plotArea().center() - mousePos;
chart()->scroll(delta.x(), -delta.y());
QChartView::wheelEvent(event);
}