#4983 Fix drag zoom on Summary and Grid cross plots

This commit is contained in:
Gaute Lindkvist
2019-11-05 08:27:35 +01:00
parent 7d817d0277
commit c7b5957571
7 changed files with 67 additions and 9 deletions

View File

@@ -49,6 +49,7 @@
#include <QFont>
#include <QFontMetrics>
#include <QGraphicsDropShadowEffect>
#include <QLabel>
#include <QMimeData>
#include <QMouseEvent>
#include <QScrollArea>
@@ -473,9 +474,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>( event );
if ( mouseEvent )
{
// Shift is the zoom modifier and is reserved for QwtZoomPickers
bool zoomModifierApplied = ( mouseEvent->modifiers() & Qt::ShiftModifier ) != 0;
if ( zoomModifierApplied ) return false;
if ( isZoomerActive() ) return false;
bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0;
@@ -520,6 +519,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
else
{
selectPlotOwner( toggleItemInSelection );
endZoomOperations();
return true;
}
}
@@ -530,6 +530,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
!m_clickPosition.isNull() )
{
selectClosestCurve( mouseEvent->pos(), toggleItemInSelection );
endZoomOperations();
return true;
}
}
@@ -590,6 +591,19 @@ void RiuQwtPlotWidget::selectPoint( QwtPlotCurve* curve, int pointNumber ) {}
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::clearPointSelection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuQwtPlotWidget::isZoomerActive() const
{
return false;
}
//--------------------------------------------------------------------------------------------------
/// Empty default implementation
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::endZoomOperations() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -613,7 +627,7 @@ RiuWidgetStyleSheet RiuQwtPlotWidget::createPlotStyleSheet() const
{
QColor backgroundColor = QColor( "white" );
QColor highlightColor = QApplication::palette().highlight().color();
QColor blendedHighlightColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 5 );
QColor blendedHighlightColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 10 );
QColor nearlyBackgroundColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 30 );
RiuWidgetStyleSheet styleSheet;
@@ -625,7 +639,7 @@ RiuWidgetStyleSheet RiuQwtPlotWidget::createPlotStyleSheet() const
if ( m_draggable )
{
QString backgroundGradient = QString( QString( "qlineargradient( x1 : 1, y1 : 0, x2 : 1, y2 : 1,"
"stop: 0 %1, stop: 0.02 %2, stop:1 %3 )" )
"stop: 0 %1, stop: 0.015 %2, stop:1 %3 )" )
.arg( blendedHighlightColor.name() )
.arg( nearlyBackgroundColor.name() )
.arg( backgroundColor.name() ) );