Backed out changeset: 87f0955a62ad ref #841.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-05-07 14:23:47 +03:00
parent ee6ffab480
commit 3b4007a40c
10 changed files with 38 additions and 14 deletions

View File

@ -86,7 +86,7 @@ void DialogHistory::DialogAccepted()
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole)); quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, false); emit ShowHistoryTool(id, false);
accept(); emit DialogClosed(QDialog::Accepted);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -1321,7 +1321,7 @@ void DialogIncrements::closeEvent(QCloseEvent *event)
ui->plainTextEditDescription->blockSignals(true); ui->plainTextEditDescription->blockSignals(true);
emit UpdateProperties(); emit UpdateProperties();
accept(); emit DialogClosed(QDialog::Accepted);
event->accept(); event->accept();
} }

View File

@ -661,7 +661,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject); connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject); connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
connect(dialogTool.data(), &DialogTool::finished, this, closeDialogSlot); connect(dialogTool.data(), &DialogTool::DialogClosed, this, closeDialogSlot);
connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); connect(dialogTool.data(), &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
emit ui->view->itemClicked(nullptr); emit ui->view->itemClicked(nullptr);
} }
@ -4205,7 +4205,7 @@ void MainWindow::CreateActions()
dialogHistory = new DialogHistory(pattern, doc, this); dialogHistory = new DialogHistory(pattern, doc, this);
dialogHistory->setWindowFlags(Qt::Window); dialogHistory->setWindowFlags(Qt::Window);
connect(this, &MainWindow::RefreshHistory, dialogHistory.data(), &DialogHistory::UpdateHistory); connect(this, &MainWindow::RefreshHistory, dialogHistory.data(), &DialogHistory::UpdateHistory);
connect(dialogHistory.data(), &DialogHistory::finished, this, [this]() connect(dialogHistory.data(), &DialogHistory::DialogClosed, this, [this]()
{ {
ui->actionHistory->setChecked(false); ui->actionHistory->setChecked(false);
delete dialogHistory; delete dialogHistory;
@ -4253,7 +4253,7 @@ void MainWindow::CreateActions()
dialogTable = new DialogIncrements(pattern, doc, this); dialogTable = new DialogIncrements(pattern, doc, this);
connect(dialogTable.data(), &DialogIncrements::UpdateProperties, toolOptions, connect(dialogTable.data(), &DialogIncrements::UpdateProperties, toolOptions,
&VToolOptionsPropertyBrowser::RefreshOptions); &VToolOptionsPropertyBrowser::RefreshOptions);
connect(dialogTable.data(), &DialogIncrements::finished, this, [this]() connect(dialogTable.data(), &DialogIncrements::DialogClosed, this, [this]()
{ {
ui->actionTable->setChecked(false); ui->actionTable->setChecked(false);
delete dialogTable; delete dialogTable;

View File

@ -133,7 +133,15 @@ DialogEditWrongFormula::~DialogEditWrongFormula()
void DialogEditWrongFormula::DialogAccepted() void DialogEditWrongFormula::DialogAccepted()
{ {
formula = ui->plainTextEditFormula->toPlainText(); formula = ui->plainTextEditFormula->toPlainText();
accept(); emit DialogClosed(QDialog::Accepted);
emit accepted();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::DialogRejected()
{
emit DialogClosed(QDialog::Rejected);
emit rejected();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -72,6 +72,7 @@ public:
void SetPreviewCalculationsMode(); void SetPreviewCalculationsMode();
public slots: public slots:
virtual void DialogAccepted() Q_DECL_OVERRIDE; virtual void DialogAccepted() Q_DECL_OVERRIDE;
virtual void DialogRejected() Q_DECL_OVERRIDE;
virtual void EvalFormula() Q_DECL_OVERRIDE; virtual void EvalFormula() Q_DECL_OVERRIDE;
void ValChanged(int row); void ValChanged(int row);
void PutHere(); void PutHere();

View File

@ -183,7 +183,7 @@ DialogTool::~DialogTool()
*/ */
void DialogTool::closeEvent(QCloseEvent *event) void DialogTool::closeEvent(QCloseEvent *event)
{ {
reject(); DialogRejected();
event->accept(); event->accept();
} }
@ -1181,7 +1181,7 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color)
void DialogTool::DialogAccepted() void DialogTool::DialogAccepted()
{ {
SaveData(); SaveData();
accept(); emit DialogClosed(QDialog::Accepted);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1191,6 +1191,15 @@ void DialogTool::DialogApply()
emit DialogApplied(); emit DialogApplied();
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogRejected emit signal dialog rejected
*/
void DialogTool::DialogRejected()
{
emit DialogClosed(QDialog::Rejected);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief formula check formula * @brief formula check formula

View File

@ -97,6 +97,11 @@ public:
static void MoveListRowDown(QListWidget *list); static void MoveListRowDown(QListWidget *list);
static void MoveListRowBottom(QListWidget *list); static void MoveListRowBottom(QListWidget *list);
signals: signals:
/**
* @brief DialogClosed signal dialog closed
* @param result keep result
*/
void DialogClosed(int result);
/** /**
* @brief DialogApplied emit signal dialog apply changes * @brief DialogApplied emit signal dialog apply changes
*/ */
@ -115,6 +120,7 @@ public slots:
* @brief DialogApply save data and emit signal DialogApplied. * @brief DialogApply save data and emit signal DialogApplied.
*/ */
virtual void DialogApply(); virtual void DialogApply();
virtual void DialogRejected();
void FormulaChanged(); void FormulaChanged();
/** /**
* @brief FormulaChangedPlainText check formula (plain text editor editor) * @brief FormulaChangedPlainText check formula (plain text editor editor)
@ -361,7 +367,7 @@ inline void DialogTool::InitOkCancel(T *ui)
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr) SCASSERT(bCancel != nullptr)
connect(bCancel, &QPushButton::clicked, this, &DialogTool::reject); connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c()); qApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
} }

View File

@ -713,7 +713,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
dialog->EnbleShowMode(true); dialog->EnbleShowMode(true);
m_dialog = dialog; m_dialog = dialog;
m_dialog->setModal(true); m_dialog->setModal(true);
connect(m_dialog.data(), &DialogTool::finished, this, &DialogSeamAllowance::PathDialogClosed); connect(m_dialog.data(), &DialogTool::DialogClosed, this, &DialogSeamAllowance::PathDialogClosed);
m_dialog->show(); m_dialog->show();
} }
} }
@ -749,7 +749,7 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
dialog->EnbleShowMode(true); dialog->EnbleShowMode(true);
m_dialog = dialog; m_dialog = dialog;
m_dialog->setModal(true); m_dialog->setModal(true);
connect(m_dialog.data(), &DialogTool::finished, this, &DialogSeamAllowance::PathDialogClosed); connect(m_dialog.data(), &DialogTool::DialogClosed, this, &DialogSeamAllowance::PathDialogClosed);
m_dialog->show(); m_dialog->show();
} }
} }
@ -846,7 +846,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
dialog->EnbleShowMode(true); dialog->EnbleShowMode(true);
m_dialog = dialog; m_dialog = dialog;
m_dialog->setModal(true); m_dialog->setModal(true);
connect(m_dialog.data(), &DialogTool::finished, this, &DialogSeamAllowance::PlaceLabelDialogClosed); connect(m_dialog.data(), &DialogTool::DialogClosed, this, &DialogSeamAllowance::PlaceLabelDialogClosed);
m_dialog->show(); m_dialog->show();
} }
else if (selectedAction == actionSegment) else if (selectedAction == actionSegment)

View File

@ -263,7 +263,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
m_dialog = QSharedPointer<Dialog>(new Dialog(getData(), m_id, qApp->getMainWindow())); m_dialog = QSharedPointer<Dialog>(new Dialog(getData(), m_id, qApp->getMainWindow()));
m_dialog->setModal(true); m_dialog->setModal(true);
connect(m_dialog.data(), &DialogTool::finished, this, &VDrawTool::FullUpdateFromGuiOk); connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VDrawTool::FullUpdateFromGuiOk);
connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VDrawTool::FullUpdateFromGuiApply); connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VDrawTool::FullUpdateFromGuiApply);
this->setDialog(); this->setDialog();

View File

@ -1470,7 +1470,7 @@ void VToolSeamAllowance::ShowOptions()
dialog->EnableApply(true); dialog->EnableApply(true);
m_dialog = dialog; m_dialog = dialog;
m_dialog->setModal(true); m_dialog->setModal(true);
connect(m_dialog.data(), &DialogTool::finished, this, &VToolSeamAllowance::FullUpdateFromGuiOk); connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VToolSeamAllowance::FullUpdateFromGuiOk);
connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VToolSeamAllowance::FullUpdateFromGuiApply); connect(m_dialog.data(), &DialogTool::DialogApplied, this, &VToolSeamAllowance::FullUpdateFromGuiApply);
SetDialog(); SetDialog();
m_dialog->show(); m_dialog->show();