diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index d160e40079..e8361f003b 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -313,6 +313,7 @@ list( ${CMAKE_CURRENT_LIST_DIR}/RiuTextContentFrame.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtLegendOverlayContentFrame.h ${CMAKE_CURRENT_LIST_DIR}/RiuMatrixPlotWidget.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotZoomerMultiAxes.h ) list(APPEND QT_UI_FILES) diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp index ced8ef81ef..26bc24464d 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp @@ -69,12 +69,6 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren m_zoomerLeft->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerLeft->initMousePattern( 1 ); - // Attach a zoomer for the right axis - m_zoomerRight = new RiuQwtPlotZoomer( qwtPlot()->canvas() ); - m_zoomerRight->setAxes( QwtAxis::XTop, QwtAxis::YRight ); - m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); - m_zoomerRight->initMousePattern( 1 ); - // MidButton for the panning QwtPlotPanner* panner = new QwtPlotPanner( qwtPlot()->canvas() ); panner->setMouseButton( Qt::MiddleButton ); @@ -82,8 +76,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren auto wheelZoomer = new RiuQwtPlotWheelZoomer( qwtPlot() ); connect( wheelZoomer, SIGNAL( zoomUpdated() ), SLOT( onZoomedSlot() ) ); - connect( m_zoomerLeft, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) ); - connect( m_zoomerRight, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) ); + connect( m_zoomerLeft, SIGNAL( zoomed() ), SLOT( onZoomedSlot() ) ); connect( panner, SIGNAL( panned( int, int ) ), SLOT( onZoomedSlot() ) ); connect( this, SIGNAL( plotItemSelected( std::shared_ptr, bool, int ) ), @@ -254,7 +247,7 @@ bool RiuGridCrossQwtPlot::curveText( const QwtPlotCurve* curve, QString* curveTi //-------------------------------------------------------------------------------------------------- bool RiuGridCrossQwtPlot::isZoomerActive() const { - return m_zoomerLeft->isActiveAndValid() || m_zoomerRight->isActiveAndValid(); + return m_zoomerLeft->isActiveAndValid(); } //-------------------------------------------------------------------------------------------------- @@ -263,7 +256,6 @@ bool RiuGridCrossQwtPlot::isZoomerActive() const void RiuGridCrossQwtPlot::endZoomOperations() { m_zoomerLeft->endZoomOperation(); - m_zoomerRight->endZoomOperation(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h index 597a5304e7..f67e985333 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h @@ -74,5 +74,4 @@ private slots: QwtPlotMarker* m_selectedPointMarker; QPointer m_zoomerLeft; - QPointer m_zoomerRight; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.cpp index b83cdc2993..3f2433c599 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.cpp @@ -88,23 +88,24 @@ void RiuQwtPlotZoomerMultiAxes::zoomFromScreenCoords( const QRectF& screenCoords const double screenX2 = screenCoords.right(); double domainX1 = map.invTransform( screenX1 ); double domainX2 = map.invTransform( screenX2 ); - if ( !plot->axisScaleDiv( axisId ).isIncreasing() ) qSwap( domainX1, domainX2 ); + if ( domainX1 > domainX2 ) qSwap( domainX1, domainX2 ); plot->setAxisScale( axisId, domainX1, domainX2 ); } else { - const double screenY1 = screenCoords.top(); - const double screenY2 = screenCoords.bottom(); + const double screenY1 = screenCoords.bottom(); + const double screenY2 = screenCoords.top(); double domainY1 = map.invTransform( screenY1 ); double domainY2 = map.invTransform( screenY2 ); - if ( plot->axisScaleDiv( axisId ).isIncreasing() ) qSwap( domainY1, domainY2 ); plot->setAxisScale( axisId, domainY1, domainY2 ); } } - - plot->setAutoReplot( doReplot ); - plot->replot(); } + + plot->setAutoReplot( doReplot ); + plot->replot(); + + emit zoomed(); } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.h b/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.h index 8024e8ac19..e706bf4731 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotZoomerMultiAxes.h @@ -25,9 +25,13 @@ //-------------------------------------------------------------------------------------------------- class RiuQwtPlotZoomerMultiAxes : public QwtPlotPicker { + Q_OBJECT public: explicit RiuQwtPlotZoomerMultiAxes( QWidget*, bool doReplot = true ); +Q_SIGNALS: + void zoomed(); + protected: bool end( bool ok = true ) override; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index c2f5606f34..86b2d44814 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -92,7 +92,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= m_wheelZoomer = new RiuQwtPlotWheelZoomer( m_plotWidget->qwtPlot() ); connect( m_wheelZoomer, SIGNAL( zoomUpdated() ), SLOT( onZoomedSlot() ) ); - connect( m_zoomerLeft, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) ); + connect( m_zoomerLeft, SIGNAL( zoomed() ), SLOT( onZoomedSlot() ) ); connect( panner, SIGNAL( panned( int, int ) ), SLOT( onZoomedSlot() ) ); setDefaults();