(#466) Clicking a plot track selects the item in the project tree view

This commit is contained in:
Pål Hagen 2015-09-17 10:53:37 +02:00
parent 6b5aaecc80
commit ce6c33fa09
2 changed files with 18 additions and 1 deletions

View File

@ -22,6 +22,10 @@
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrace.h"
#include "RiuMainWindow.h"
#include "cafPdmUiTreeView.h"
#include "qwt_plot_grid.h"
#include "qwt_legend.h"
#include "qwt_scale_engine.h"
@ -49,7 +53,8 @@ RiuWellLogTracePlot::RiuWellLogTracePlot(RimWellLogPlotTrace* plotTraceDefinitio
m_legend = new QwtLegend(this);
insertLegend(m_legend, QwtPlot::TopLegend);
setFocusPolicy(Qt::ClickFocus);
setDefaults();
}
@ -189,3 +194,14 @@ bool RiuWellLogTracePlot::eventFilter(QObject* watched, QEvent* event)
return QwtPlot::eventFilter(watched, event);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTracePlot::focusInEvent(QFocusEvent* event)
{
if (m_plotTraceDefinition)
{
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(m_plotTraceDefinition);
}
}

View File

@ -45,6 +45,7 @@ public:
protected:
virtual bool eventFilter(QObject* watched, QEvent* event);
virtual void focusInEvent(QFocusEvent* event);
private:
void setDefaults();