diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index 4ab03f4d0d..cad86a5062 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -20,14 +20,17 @@ #include "RiuWellLogPlot.h" #include "RiuWellLogTracePlot.h" +#include "RiuMainWindow.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotTrace.h" +#include "cafPdmUiTreeView.h" #include "cvfAssert.h" #include #include +#include #include @@ -50,6 +53,8 @@ RiuWellLogPlot::RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent) m_layout->addWidget(m_scrollBar); connect(m_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotSetMinDepth(int))); + + setFocusPolicy(Qt::ClickFocus); } //-------------------------------------------------------------------------------------------------- @@ -126,3 +131,15 @@ RimWellLogPlot* RiuWellLogPlot::ownerPlotDefinition() { return m_plotDefinition; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuWellLogPlot::focusInEvent(QFocusEvent* event) +{ + if (m_plotDefinition) + { + RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(m_plotDefinition); + clearFocus(); + } +} diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.h b/ApplicationCode/UserInterface/RiuWellLogPlot.h index 60c9ce0923..d156c5619d 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.h @@ -28,6 +28,7 @@ class RiuWellLogTracePlot; class QHBoxLayout; class QScrollBar; +class QFocusEvent; //================================================================================================== // @@ -48,6 +49,9 @@ public: void setDepthRangeAndReplot(double minDepth, double maxDepth); +protected: + virtual void focusInEvent(QFocusEvent* event); + private: void updateScrollBar(double minDepth, double maxDepth); diff --git a/ApplicationCode/UserInterface/RiuWellLogTracePlot.cpp b/ApplicationCode/UserInterface/RiuWellLogTracePlot.cpp index 2848fabf6d..138cca895b 100644 --- a/ApplicationCode/UserInterface/RiuWellLogTracePlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogTracePlot.cpp @@ -219,6 +219,7 @@ void RiuWellLogTracePlot::focusInEvent(QFocusEvent* event) if (m_plotTraceDefinition) { RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(m_plotTraceDefinition); + clearFocus(); } }