Merge pull request #8387 from OPM/qtcharts-summary-plots

Closes #8228 

Major refactoring of summary plotting. Now possible to create plots both with Qwt and QtChart as plotting tool.
This commit is contained in:
Kristian Bendiksen
2022-01-17 13:14:21 +01:00
committed by GitHub
parent d9bb82de91
commit 258fbddc10
145 changed files with 7245 additions and 2932 deletions

View File

@@ -27,7 +27,7 @@ RiuQtChartView::RiuQtChartView( RimPlotWindow* plotWindow, QWidget* parent )
: QtCharts::QChartView( parent )
, m_plotWindow( plotWindow )
{
CAF_ASSERT( m_plotWindow );
setMouseTracking( true );
}
//--------------------------------------------------------------------------------------------------
@@ -44,3 +44,57 @@ RimViewWindow* RiuQtChartView::ownerViewWindow() const
{
return m_plotWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartView::mousePressEvent( QMouseEvent* event )
{
if ( event->buttons() & Qt::MiddleButton )
{
m_isPanning = true;
m_panStartPosition = event->pos();
setCursor( Qt::ClosedHandCursor );
event->accept();
}
else
{
event->ignore();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event )
{
if ( event->buttons() & Qt::MiddleButton )
{
m_isPanning = false;
setCursor( Qt::ArrowCursor );
event->accept();
}
else
{
event->ignore();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartView::mouseMoveEvent( QMouseEvent* event )
{
if ( event->buttons() & Qt::MiddleButton && m_isPanning )
{
QPoint newPosition = event->pos();
QPointF delta = mapToScene( newPosition ) - mapToScene( m_panStartPosition );
chart()->scroll( -delta.x(), delta.y() );
m_panStartPosition = newPosition;
event->accept();
}
else
{
event->ignore();
}
}