#3924 Measurements : Remove double mouse click event handling

This commit is contained in:
Magne Sjaastad committed 2019-01-03 07:33:54 +01:00
1 parent 8f85e49849
commit 3543ba7cf3
5 files changed
+9 -162

No files matched your search

@@ -153,7 +153,6 @@ ${CMAKE_CURRENT_LIST_DIR}/Riu3DMainWindowTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuDockWidgetTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotItemGroup.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellPathComponentPlotItem.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuMeasurementViewEventFilter.cpp
)
list(APPEND CODE_HEADER_FILES
@@ -198,7 +197,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuMessagePanel.h
${CMAKE_CURRENT_LIST_DIR}/RiuExpressionContextMenuManager.h
${CMAKE_CURRENT_LIST_DIR}/RiuCalculationsContextMenuManager.h
${CMAKE_CURRENT_LIST_DIR}/RiuMohrsCirclePlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuMeasurementViewEventFilter.h
)
list(APPEND QT_UI_FILES
@@ -1,88 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuMeasurementViewEventFilter.h"
#include "ToggleCommands/RicToggleItemsFeatureImpl.h"
#include "RiaApplication.h"
#include "RimCaseCollection.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMeasurement.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h"
#include "cafCmdFeature.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmUiTreeView.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QKeyEvent>
#include <QTreeView>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuMeasurementViewEventFilter::RiuMeasurementViewEventFilter(QObject* parent)
: QObject(parent), m_inResetMeasurementMode(false)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuMeasurementViewEventFilter::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::MouseButtonDblClick)
{
auto* mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::MouseButton::LeftButton)
{
auto* measurement = RiaApplication::instance()->project()->measurement();
measurement->removeAllPoints();
m_inResetMeasurementMode = true;
//Swallow event
return true;
}
}
else if (m_inResetMeasurementMode && event->type() == QEvent::MouseButtonRelease)
{
// This code is necessary to prevent setting a new measurement point when double clicking
auto* mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::MouseButton::LeftButton)
{
m_inResetMeasurementMode = false;
// Swallow event
return true;
}
}
// standard event processing
return QObject::eventFilter(obj, event);
}
@@ -1,38 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
#include <QEvent>
//--------------------------------------------------------------------------------------------------
class RiuMeasurementViewEventFilter : public QObject
{
Q_OBJECT
public:
explicit RiuMeasurementViewEventFilter(QObject* parent);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
bool m_inResetMeasurementMode;
};