mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1404 Select corresponding object before displaying context menu
This commit is contained in:
parent
7592137b78
commit
0292f06aea
@ -39,13 +39,21 @@ RiuPlotObjectPicker::RiuPlotObjectPicker(QWidget* widget, caf::PdmObject* associ
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiuPlotObjectPicker::eventFilter(QObject* watchedObject, QEvent* event)
|
bool RiuPlotObjectPicker::eventFilter(QObject* watchedObject, QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseButtonRelease)
|
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||||
|
if (mainPlotWindow && m_associatedObject.notNull())
|
||||||
{
|
{
|
||||||
QMouseEvent* me = static_cast<QMouseEvent*>(event);
|
if (event->type() == QEvent::MouseButtonPress)
|
||||||
if (me->button() == Qt::LeftButton)
|
|
||||||
{
|
{
|
||||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
QMouseEvent* me = static_cast<QMouseEvent*>(event);
|
||||||
if (mainPlotWindow && m_associatedObject.notNull())
|
if (me->button() == Qt::RightButton)
|
||||||
|
{
|
||||||
|
mainPlotWindow->selectAsCurrentItem(m_associatedObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (event->type() == QEvent::MouseButtonRelease)
|
||||||
|
{
|
||||||
|
QMouseEvent* me = static_cast<QMouseEvent*>(event);
|
||||||
|
if (me->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
mainPlotWindow->selectAsCurrentItem(m_associatedObject);
|
mainPlotWindow->selectAsCurrentItem(m_associatedObject);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user