mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
committed by
GitHub
parent
d9bb82de91
commit
258fbddc10
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user