Refactoring and bug fix in dialog Piece path.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-01-31 14:28:05 +02:00
parent 21e034ef71
commit 637eaa4256
2 changed files with 6 additions and 19 deletions

View File

@ -175,10 +175,6 @@ void DialogPiecePath::ShowDialog(bool click)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::SaveData()
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::CheckState() void DialogPiecePath::CheckState()
{ {
@ -841,18 +837,7 @@ void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 DialogPiecePath::GetPieceId() const quint32 DialogPiecePath::GetPieceId() const
{ {
quint32 id = NULL_ID; return getCurrentObjectId(ui->comboBoxPiece);
if (ui->comboBoxPiece->count() > 0)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
id = ui->comboBoxPiece->itemData(ui->comboBoxPiece->currentIndex()).toUInt();
#else
id = ui->comboBoxPiece->currentData().toUInt();
#endif
}
return id;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -868,7 +853,11 @@ void DialogPiecePath::SetPieceId(quint32 id)
const qint32 index = ui->comboBoxPiece->findData(id); const qint32 index = ui->comboBoxPiece->findData(id);
if (index != -1) if (index != -1)
{ {
ui->comboBoxType->setCurrentIndex(index); ui->comboBoxPiece->setCurrentIndex(index);
}
else
{
ui->comboBoxPiece->setCurrentIndex(0);
} }
} }

View File

@ -61,8 +61,6 @@ public slots:
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE; virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
protected: protected:
/** @brief SaveData Put dialog data in local variables */
virtual void SaveData() Q_DECL_OVERRIDE;
virtual void CheckState() Q_DECL_OVERRIDE; virtual void CheckState() Q_DECL_OVERRIDE;
virtual void ShowVisualization() Q_DECL_OVERRIDE; virtual void ShowVisualization() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;