mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#871 Keep new zoom settings when toggling the curves/curve filter
This commit is contained in:
parent
b3657bcf43
commit
b2728b070b
@ -232,6 +232,7 @@ set ( QT_MOC_HEADERS
|
||||
UserInterface/RiuWellLogPlot.h
|
||||
UserInterface/RiuWellLogTrack.h
|
||||
UserInterface/RiuRecentFileActionProvider.h
|
||||
UserInterface/RiuSummaryQwtPlot.h
|
||||
)
|
||||
|
||||
qt4_wrap_cpp( MOC_FILES_CPP ${QT_MOC_HEADERS} )
|
||||
|
@ -323,7 +323,7 @@ void RimSummaryCurve::updateZoomInParentPlot()
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
|
||||
plot->updateZoom();
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -160,6 +160,24 @@ QWidget* RimSummaryPlot::viewer()
|
||||
return m_qwtPlot;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setZoomWindow(const QRectF& zoomWindow)
|
||||
{
|
||||
if(!zoomWindow.isEmpty())
|
||||
{
|
||||
std::vector<float> window;
|
||||
window.push_back(zoomWindow.left());
|
||||
window.push_back(zoomWindow.top());
|
||||
window.push_back(zoomWindow.width());
|
||||
window.push_back(zoomWindow.height());
|
||||
|
||||
m_visibleWindow = window;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -168,6 +186,7 @@ void RimSummaryPlot::zoomAll()
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
m_qwtPlot->zoomAll();
|
||||
this->setZoomWindow(m_qwtPlot->currentVisibleWindow());
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,19 +258,7 @@ void RimSummaryPlot::setupBeforeSave()
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_qwtPlot));
|
||||
}
|
||||
|
||||
QRectF visibleWindow = m_qwtPlot->currentVisibleWindow();
|
||||
if (!visibleWindow.isEmpty())
|
||||
{
|
||||
//QRectF(qreal left, qreal top, qreal width, qreal height);
|
||||
|
||||
std::vector<float> window;
|
||||
window.push_back(visibleWindow.left());
|
||||
window.push_back(visibleWindow.top());
|
||||
window.push_back(visibleWindow.width());
|
||||
window.push_back(visibleWindow.height());
|
||||
|
||||
m_visibleWindow = window;
|
||||
}
|
||||
this->setZoomWindow(m_qwtPlot->currentVisibleWindow());
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,13 +303,13 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
|
||||
this->updateYAxisUnit();
|
||||
|
||||
updateZoom();
|
||||
updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateZoom()
|
||||
void RimSummaryPlot::updateZoomInQwt()
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void updateZoom();
|
||||
|
||||
void handleViewerDeletion();
|
||||
void updateYAxisUnit();
|
||||
@ -61,8 +60,9 @@ public:
|
||||
|
||||
QWidget* viewer();
|
||||
|
||||
|
||||
void setZoomWindow(const QRectF& zoomWindow);
|
||||
virtual void zoomAll() override;
|
||||
void updateZoomInQwt();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user