diff --git a/omodsim/formmodsim.cpp b/omodsim/formmodsim.cpp index 30a9461..eb00abf 100644 --- a/omodsim/formmodsim.cpp +++ b/omodsim/formmodsim.cpp @@ -73,8 +73,6 @@ FormModSim::FormModSim(int id, ModbusMultiServer& server, QSharedPointerframeDataDefinition->installEventFilter(this); } /// @@ -115,21 +113,17 @@ void FormModSim::closeEvent(QCloseEvent* event) } /// -/// \brief FormModSim::eventFilter -/// \param watched +/// \brief FormModSim::mouseDoubleClickEvent /// \param event /// \return /// -bool FormModSim::eventFilter(QObject* watched, QEvent* event) +void FormModSim::mouseDoubleClickEvent(QMouseEvent* event) { - if (watched == ui->frameDataDefinition && event->type() == QEvent::MouseButtonDblClick) { - auto* me = static_cast(event); - if(me->pos().x() > ui->statisticWidget->geometry().right()) { - emit doubleClicked(); - return true; - } + if(ui->frameDataDefinition->geometry().contains(event->pos())) { + emit doubleClicked(); } - return QWidget::eventFilter(watched, event); + + return QWidget::mouseDoubleClickEvent(event); } /// diff --git a/omodsim/formmodsim.h b/omodsim/formmodsim.h index ad865e6..99181a8 100644 --- a/omodsim/formmodsim.h +++ b/omodsim/formmodsim.h @@ -121,7 +121,7 @@ class FormModSim : public QWidget protected: void changeEvent(QEvent* event) override; void closeEvent(QCloseEvent* event) override; - bool eventFilter(QObject* watched, QEvent* event) override; + void mouseDoubleClickEvent(QMouseEvent* event) override; public slots: void show();