From c3ae63718ba8978ca63ce4f388782f5e32c43ce5 Mon Sep 17 00:00:00 2001 From: parax0 Date: Sun, 6 Mar 2016 18:05:40 -0700 Subject: [PATCH] Turn off pick mode when the link dialog is closed --- src/Editor/WorldEditor/CLinkDialog.cpp | 10 ++++++++++ src/Editor/WorldEditor/CLinkDialog.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/Editor/WorldEditor/CLinkDialog.cpp b/src/Editor/WorldEditor/CLinkDialog.cpp index 5d3b2cea..a30cc3fa 100644 --- a/src/Editor/WorldEditor/CLinkDialog.cpp +++ b/src/Editor/WorldEditor/CLinkDialog.cpp @@ -16,6 +16,7 @@ CLinkDialog::CLinkDialog(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) , mpReceiver(nullptr) , mSenderStateModel(CStateMessageModel::eStates, this) , mReceiverMessageModel(CStateMessageModel::eMessages, this) + , mIsPicking(false) , mpEditLink(nullptr) { ui->setupUi(this); @@ -48,6 +49,12 @@ void CLinkDialog::showEvent(QShowEvent *) SetReceiverNameLabel(); } +void CLinkDialog::closeEvent(QCloseEvent *) +{ + if (mIsPicking) + mpEditor->ExitPickMode(); +} + void CLinkDialog::NewLink(CScriptObject *pSender, CScriptObject *pReceiver) { mpEditLink = nullptr; @@ -193,6 +200,8 @@ void CLinkDialog::OnPickFromViewportClicked() QPushButton *pOtherButton = (pButton == ui->SenderPickFromViewport ? ui->ReceiverPickFromViewport : ui->SenderPickFromViewport); pOtherButton->setChecked(false); + + mIsPicking = true; } else @@ -217,6 +226,7 @@ void CLinkDialog::OnPickModeExit() ui->ReceiverPickFromViewport->setChecked(false); disconnect(mpEditor, SIGNAL(PickModeClick(SRayIntersection,QMouseEvent*)), this, 0); disconnect(mpEditor, SIGNAL(PickModeExited()), this, 0); + mIsPicking = false; } void CLinkDialog::OnPickFromListClicked() diff --git a/src/Editor/WorldEditor/CLinkDialog.h b/src/Editor/WorldEditor/CLinkDialog.h index 9ca71e9a..3fa9859d 100644 --- a/src/Editor/WorldEditor/CLinkDialog.h +++ b/src/Editor/WorldEditor/CLinkDialog.h @@ -23,6 +23,8 @@ class CLinkDialog : public QDialog CStateMessageModel mSenderStateModel; CStateMessageModel mReceiverMessageModel; + bool mIsPicking; + Ui::CLinkDialog *ui; public: @@ -30,6 +32,7 @@ public: ~CLinkDialog(); void resizeEvent(QResizeEvent *); void showEvent(QShowEvent *); + void closeEvent(QCloseEvent *); void NewLink(CScriptObject *pSender, CScriptObject *pReceiver); void EditLink(CLink *pLink);