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:
@@ -18,7 +18,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuCadNavigation.h"
|
||||
|
||||
#include "caf.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfHitItemCollection.h"
|
||||
#include "cvfManipulatorTrackball.h"
|
||||
@@ -121,18 +124,19 @@ bool RiuCadNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
{
|
||||
if ( inputEvent->modifiers() == Qt::NoModifier )
|
||||
{
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
auto position = caf::position( we );
|
||||
|
||||
updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() );
|
||||
updatePointOfInterestDuringZoomIfNecessary( position.x(), position.y() );
|
||||
|
||||
if ( m_isRotCenterInitialized )
|
||||
{
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( position.x(), position.y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
cvf::ref<cvf::Ray> ray = createZoomRay( translatedMousePosX, translatedMousePosY );
|
||||
|
||||
zoomAlongRay( ray.p(), -we->delta() );
|
||||
zoomAlongRay( ray.p(), -we->angleDelta().y() );
|
||||
}
|
||||
isEventHandled = true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "RiuCategoryLegendFrame.h"
|
||||
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "cafCategoryLegend.h"
|
||||
|
||||
#include "cvfqtUtils.h"
|
||||
@@ -29,7 +31,7 @@ RiuCategoryLegendFrame::~RiuCategoryLegendFrame()
|
||||
void RiuCategoryLegendFrame::layoutInfo( LayoutInfo* layout ) const
|
||||
{
|
||||
QFontMetrics fontMetrics( this->font() );
|
||||
QStringList titleLines = m_title.split( "\n", QString::SkipEmptyParts );
|
||||
QStringList titleLines = RiaTextStringTools::splitSkipEmptyParts( m_title, "\n" );
|
||||
|
||||
layout->charHeight = fontMetrics.height();
|
||||
layout->charAscent = fontMetrics.ascent();
|
||||
|
||||
@@ -235,7 +235,7 @@ Qt::DropActions RiuDragDrop::supportedDropActions() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
|
||||
{
|
||||
Qt::ItemFlags itemflags = nullptr;
|
||||
Qt::ItemFlags itemflags;
|
||||
|
||||
if ( index.isValid() && RiaGuiApplication::activeMainWindow() )
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RiaNumberFormat.h"
|
||||
|
||||
#include "RigFemClosestResultIndexCalculator.h"
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
@@ -26,6 +28,7 @@
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigFemTypes.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "RiuGeoMechXfTensorResultAccessor.h"
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
@@ -101,11 +104,12 @@ QString RiuFemTimeHistoryResultAccessor::geometrySelectionText() const
|
||||
cvf::Vec3d domainCoord = m_intersectionPointInDomain;
|
||||
text += QString( ", ijk[%1, %2, %3] " ).arg( i ).arg( j ).arg( k );
|
||||
|
||||
QString formattedText;
|
||||
formattedText.sprintf( "Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]",
|
||||
domainCoord.x(),
|
||||
domainCoord.y(),
|
||||
-domainCoord.z() );
|
||||
auto xTxt = RiaNumberFormat::valueToText( domainCoord.x(), RiaNumberFormat::NumberFormatType::FIXED, 2 );
|
||||
auto yTxt = RiaNumberFormat::valueToText( domainCoord.y(), RiaNumberFormat::NumberFormatType::FIXED, 2 );
|
||||
auto zTxt = RiaNumberFormat::valueToText( -domainCoord.z(), RiaNumberFormat::NumberFormatType::FIXED, 2 );
|
||||
|
||||
QString formattedText =
|
||||
QString( "Intersection point : [E: %1, N: %2, Depth: %3]" ).arg( xTxt ).arg( yTxt ).arg( zTxt );
|
||||
|
||||
text += formattedText;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuGeoQuestNavigation.h"
|
||||
|
||||
#include "caf.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfHitItemCollection.h"
|
||||
#include "cvfManipulatorTrackball.h"
|
||||
@@ -132,18 +135,19 @@ bool RiuGeoQuestNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
{
|
||||
if ( inputEvent->modifiers() == Qt::NoModifier )
|
||||
{
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
auto position = caf::position( we );
|
||||
|
||||
updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() );
|
||||
updatePointOfInterestDuringZoomIfNecessary( position.x(), position.y() );
|
||||
|
||||
if ( m_isRotCenterInitialized )
|
||||
{
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( position.x(), position.y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
cvf::ref<cvf::Ray> ray = createZoomRay( translatedMousePosX, translatedMousePosY );
|
||||
|
||||
zoomAlongRay( ray.p(), -we->delta() );
|
||||
zoomAlongRay( ray.p(), -we->angleDelta().y() );
|
||||
}
|
||||
isEventHandled = true;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class QStringList;
|
||||
class RiuGridStatisticsHistogramWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
RiuGridStatisticsHistogramWidget( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr );
|
||||
RiuGridStatisticsHistogramWidget( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
|
||||
|
||||
void setHistogramData( double min, double max, const std::vector<size_t>& histogram );
|
||||
void setPercentiles( double pmin, double pmax );
|
||||
|
||||
@@ -627,17 +627,12 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
|
||||
|
||||
{
|
||||
int left = 0;
|
||||
int top = 0;
|
||||
int right = 0;
|
||||
int bot = 0;
|
||||
|
||||
plotWidgets[visibleIndex]->getContentsMargins( &left, &top, &right, &bot );
|
||||
bot = 40;
|
||||
auto margins = plotWidgets[visibleIndex]->contentsMargins();
|
||||
margins.setBottom( 40 );
|
||||
|
||||
// Adjust the space below a graph to make sure the heading of the row below is closest to the
|
||||
// corresponding graph
|
||||
plotWidgets[visibleIndex]->setContentsMargins( left, top, right, bot );
|
||||
plotWidgets[visibleIndex]->setContentsMargins( margins );
|
||||
}
|
||||
|
||||
plotWidgets[visibleIndex]->show();
|
||||
|
||||
@@ -129,7 +129,7 @@ QRect RiuPlotCurveSymbol::labelBoundingRect( const QPainter* painter, const QRec
|
||||
int symbolWidth = symbolRect.width();
|
||||
int symbolHeight = symbolRect.height();
|
||||
|
||||
int labelWidth = painter->fontMetrics().width( label );
|
||||
int labelWidth = painter->fontMetrics().horizontalAdvance( label );
|
||||
int labelHeight = painter->fontMetrics().height();
|
||||
|
||||
QPoint labelPosition;
|
||||
|
||||
@@ -33,7 +33,7 @@ class PdmObjectHandle;
|
||||
class RiuProjectAndPropertyView : public QWidget
|
||||
{
|
||||
public:
|
||||
RiuProjectAndPropertyView( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr );
|
||||
RiuProjectAndPropertyView( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
|
||||
|
||||
void setPdmItem( caf::PdmUiItem* object );
|
||||
void showProperties( caf::PdmObjectHandle* object );
|
||||
@@ -41,4 +41,4 @@ public:
|
||||
private:
|
||||
caf::PdmUiTreeView* m_projectTreeView;
|
||||
caf::PdmUiPropertyView* m_propertyView;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RiuQwtPlotWheelZoomer.h"
|
||||
|
||||
#include "caf.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_scale_div.h"
|
||||
|
||||
@@ -86,15 +88,16 @@ bool RiuQwtPlotWheelZoomer::eventFilter( QObject* watched, QEvent* event )
|
||||
if ( wheelEvent )
|
||||
{
|
||||
double zoomFactor = 1.0 / RIU_SCROLLWHEEL_ZOOMFACTOR;
|
||||
if ( wheelEvent->delta() > 0 )
|
||||
if ( wheelEvent->angleDelta().y() > 0 )
|
||||
{
|
||||
zoomFactor = RIU_SCROLLWHEEL_ZOOMFACTOR;
|
||||
}
|
||||
|
||||
zoomOnAxis( m_plot, QwtPlot::xBottom, zoomFactor, wheelEvent->pos().x() );
|
||||
zoomOnAxis( m_plot, QwtPlot::xTop, zoomFactor, wheelEvent->pos().x() );
|
||||
zoomOnAxis( m_plot, QwtPlot::yLeft, zoomFactor, wheelEvent->pos().y() );
|
||||
zoomOnAxis( m_plot, QwtPlot::yRight, zoomFactor, wheelEvent->pos().y() );
|
||||
auto position = caf::position( wheelEvent );
|
||||
zoomOnAxis( m_plot, QwtPlot::xBottom, zoomFactor, position.x() );
|
||||
zoomOnAxis( m_plot, QwtPlot::xTop, zoomFactor, position.x() );
|
||||
zoomOnAxis( m_plot, QwtPlot::yLeft, zoomFactor, position.y() );
|
||||
zoomOnAxis( m_plot, QwtPlot::yRight, zoomFactor, position.y() );
|
||||
|
||||
m_plot->replot();
|
||||
emit zoomUpdated();
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuRmsNavigation.h"
|
||||
|
||||
#include "caf.h"
|
||||
#include "cafViewer.h"
|
||||
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfHitItemCollection.h"
|
||||
#include "cvfManipulatorTrackball.h"
|
||||
@@ -157,18 +160,19 @@ bool RiuRmsNavigation::handleInputEvent( QInputEvent* inputEvent )
|
||||
{
|
||||
if ( inputEvent->modifiers() == Qt::NoModifier )
|
||||
{
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
|
||||
auto position = caf::position( we );
|
||||
|
||||
updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() );
|
||||
updatePointOfInterestDuringZoomIfNecessary( position.x(), position.y() );
|
||||
|
||||
if ( m_isRotCenterInitialized )
|
||||
{
|
||||
int translatedMousePosX, translatedMousePosY;
|
||||
cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY );
|
||||
cvfEventPos( position.x(), position.y(), &translatedMousePosX, &translatedMousePosY );
|
||||
|
||||
cvf::ref<cvf::Ray> ray = createZoomRay( translatedMousePosX, translatedMousePosY );
|
||||
|
||||
zoomAlongRay( ray.p(), -we->delta() );
|
||||
zoomAlongRay( ray.p(), -we->angleDelta().y() );
|
||||
}
|
||||
isEventHandled = true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiuScalarMapperLegendFrame.h"
|
||||
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "cvfScalarMapperDiscreteLinear.h"
|
||||
#include "cvfScalarMapperDiscreteLog.h"
|
||||
#include "cvfString.h"
|
||||
@@ -72,7 +74,7 @@ void RiuScalarMapperLegendFrame::setTickFormat( NumberFormat format )
|
||||
void RiuScalarMapperLegendFrame::layoutInfo( LayoutInfo* layout ) const
|
||||
{
|
||||
QFontMetrics fontMetrics( this->font() );
|
||||
QStringList titleLines = m_title.split( "\n", QString::SkipEmptyParts );
|
||||
QStringList titleLines = RiaTextStringTools::splitSkipEmptyParts( m_title, "\n" );
|
||||
|
||||
layout->charHeight = fontMetrics.height();
|
||||
layout->charAscent = fontMetrics.ascent();
|
||||
|
||||
@@ -29,7 +29,7 @@ class QStringList;
|
||||
class RiuSimpleHistogramWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
RiuSimpleHistogramWidget( const QString& objectName, QWidget* parent = nullptr, Qt::WindowFlags f = nullptr );
|
||||
RiuSimpleHistogramWidget( const QString& objectName, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
|
||||
|
||||
void setHistogramData( double min, double max, const std::vector<size_t>& histogram );
|
||||
void setPercentiles( double pmin, double pmax );
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RiuTextContentFrame.h"
|
||||
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
@@ -168,7 +170,7 @@ void RiuTextContentFrame::paintEvent( QPaintEvent* e )
|
||||
void RiuTextContentFrame::layoutInfo( LayoutInfo* layout ) const
|
||||
{
|
||||
QFontMetrics fontMetrics( this->font() );
|
||||
QStringList titleLines = m_text.split( "\n", QString::SkipEmptyParts );
|
||||
QStringList titleLines = RiaTextStringTools::splitSkipEmptyParts( m_text, "\n" );
|
||||
|
||||
layout->charHeight = fontMetrics.height();
|
||||
layout->charAscent = fontMetrics.ascent();
|
||||
|
||||
Reference in New Issue
Block a user