#871 Keep new zoom settings when toggling the curves/curve filter

This commit is contained in:
Jacob Støren
2016-10-05 13:56:27 +02:00
parent b3657bcf43
commit b2728b070b
6 changed files with 49 additions and 26 deletions

View File

@@ -52,15 +52,18 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* pa
setDefaults();
// LeftButton for the zooming
zoomer = new QwtPlotZoomer(canvas());
zoomer->setRubberBandPen(QColor(Qt::black));
zoomer->setTrackerMode(QwtPicker::AlwaysOff);
zoomer->setTrackerPen(QColor(Qt::black));
zoomer->initMousePattern(1);
m_zoomer = new QwtPlotZoomer(canvas());
m_zoomer->setRubberBandPen(QColor(Qt::black));
m_zoomer->setTrackerMode(QwtPicker::AlwaysOff);
m_zoomer->setTrackerPen(QColor(Qt::black));
m_zoomer->initMousePattern(1);
// MidButton for the panning
QwtPlotPanner* panner = new QwtPlotPanner(canvas());
panner->setMouseButton(Qt::MidButton);
connect(m_zoomer, SIGNAL(zoomed( const QRectF & )), SLOT(onZoomedSlot()));
connect(panner, SIGNAL(panned( int , int )), SLOT(onZoomedSlot()));
}
//--------------------------------------------------------------------------------------------------
@@ -103,7 +106,7 @@ void RiuSummaryQwtPlot::zoomAll()
setAxisAutoScale(yLeft, true);
setAxisAutoScale(xBottom, true);
zoomer->setZoomBase(true);
m_zoomer->setZoomBase(true);
}
//--------------------------------------------------------------------------------------------------
@@ -126,7 +129,7 @@ QRectF RiuSummaryQwtPlot::currentVisibleWindow() const
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::setZoomWindow(const QRectF& zoomWindow)
{
zoomer->zoom(zoomWindow);
m_zoomer->zoom(zoomWindow);
}
//--------------------------------------------------------------------------------------------------
@@ -280,3 +283,11 @@ void RiuSummaryQwtPlot::selectClosestCurve(const QPoint& pos)
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::onZoomedSlot()
{
m_plotDefinition->setZoomWindow(currentVisibleWindow());
}

View File

@@ -36,6 +36,7 @@ class RimSummaryPlot;
//==================================================================================================
class RiuSummaryQwtPlot : public QwtPlot
{
Q_OBJECT;
public:
RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* parent = NULL);
virtual ~RiuSummaryQwtPlot();
@@ -54,10 +55,13 @@ private:
void setDefaults();
void selectClosestCurve(const QPoint& pos);
private slots:
void onZoomedSlot( );
private:
QwtPlotGrid* m_grid;
caf::PdmPointer<RimSummaryPlot> m_plotDefinition;
QPointer<QwtPlotZoomer> zoomer;
QPointer<QwtPlotZoomer> m_zoomer;
};