mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix several deprecation warnings (#8657)
* Use constructor instead of nullptr for WindowFlags * Use constructor instead of nullptr for Alignment * Disable deprecation warning for QProcess * Add string split method to RaTextStringTools * Add caf.cpp used to manage Qt function deprecations * Use position()
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "RiuQtChartsPlotCurve.h"
|
||||
#include "RiuQwtDateScaleWrapper.h"
|
||||
|
||||
#include "caf.h"
|
||||
#include "cafAssert.h"
|
||||
|
||||
#include "cvfTrace.h"
|
||||
@@ -1160,9 +1161,9 @@ void RiuQtChartsPlotWidget::dropEvent( QDropEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* event )
|
||||
void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* wheelEvent )
|
||||
{
|
||||
float factor = event->angleDelta().y() > 0 ? 0.9 : 1.1;
|
||||
float factor = wheelEvent->angleDelta().y() > 0 ? 0.9 : 1.1;
|
||||
|
||||
QRectF plotAreaRect = m_viewer->chart()->plotArea();
|
||||
QPointF centerPoint = plotAreaRect.center();
|
||||
@@ -1171,14 +1172,16 @@ void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* event )
|
||||
plotAreaRect.setWidth( plotAreaRect.width() * factor );
|
||||
plotAreaRect.setHeight( plotAreaRect.height() * factor );
|
||||
|
||||
auto position = caf::position( wheelEvent );
|
||||
|
||||
// Find new center which keeps the mouse location in the same place in the plot
|
||||
QPointF newCenterPoint( ( 2 * centerPoint - event->pos() ) - ( centerPoint - event->pos() ) / factor );
|
||||
QPointF newCenterPoint( ( 2 * centerPoint - position ) - ( centerPoint - position ) / factor );
|
||||
plotAreaRect.moveCenter( newCenterPoint );
|
||||
|
||||
// Zoom in on the adjusted plot area
|
||||
m_viewer->chart()->zoomIn( plotAreaRect );
|
||||
|
||||
event->accept();
|
||||
wheelEvent->accept();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user