mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#466) Made sure that selecting plots and plot tracks both work
Both widgets accept focus events and select the corresponding items in the project tree view. Focus is cleared immediately in the focus event handlers, so that plot tracks won't steal focus from the plots in subsequent selections of plots.
This commit is contained in:
parent
71b4ce9221
commit
08adcd5df7
@ -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 <QHBoxLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QFocusEvent>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -219,6 +219,7 @@ void RiuWellLogTracePlot::focusInEvent(QFocusEvent* event)
|
||||
if (m_plotTraceDefinition)
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(m_plotTraceDefinition);
|
||||
clearFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user