Turn off pick mode when the link dialog is closed

This commit is contained in:
parax0 2016-03-06 18:05:40 -07:00
parent 8f82dcbdd9
commit c3ae63718b
2 changed files with 13 additions and 0 deletions

View File

@ -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()

View File

@ -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);