mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Make a copie of previous table model when unlink a table from her previous table.
This commit is contained in:
@@ -39,6 +39,19 @@ NomenclatureModel::NomenclatureModel(QETProject *project, QObject *parent) :
|
||||
connect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &NomenclatureModel::dataBaseUpdated);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NomenclatureModel::NomenclatureModel
|
||||
* @param other_model
|
||||
*/
|
||||
NomenclatureModel::NomenclatureModel(const NomenclatureModel &other_model)
|
||||
{
|
||||
this->setParent(other_model.parent());
|
||||
m_project = other_model.m_project;
|
||||
connect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &NomenclatureModel::dataBaseUpdated);
|
||||
m_index_0_0_data = other_model.m_index_0_0_data;
|
||||
query(other_model.queryString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NomenclatureModel::rowCount
|
||||
* Reimplemented for QAbstractTableModel
|
||||
@@ -346,5 +359,6 @@ void NomenclatureModel::fillValue()
|
||||
++i;
|
||||
}
|
||||
m_record << record_;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ class NomenclatureModel : public QAbstractTableModel
|
||||
|
||||
public:
|
||||
explicit NomenclatureModel(QETProject *project, QObject *parent = nullptr);
|
||||
explicit NomenclatureModel (const NomenclatureModel &other_model);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
@@ -313,9 +313,9 @@ void QetGraphicsTableItem::setPreviousTable(QetGraphicsTableItem *table)
|
||||
m_previous_table->setNextTable(this);
|
||||
setModel(m_previous_table->m_model);
|
||||
}
|
||||
else //Remove model
|
||||
{
|
||||
setModel(nullptr);
|
||||
else //Copie the model of old previous table
|
||||
{
|
||||
setModel(new NomenclatureModel(*static_cast<NomenclatureModel *>(old_previous_table->model())));
|
||||
}
|
||||
|
||||
if (old_previous_table &&
|
||||
|
||||
Reference in New Issue
Block a user