mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 10:30:53 +01:00
Terminal strip editor can now edit multiple project.
Before this this commit the terminal strip editor couldn't only work on the first project opened into this editor, all other project opened after couldn't be edited. This is now past, terminal strip editor can now edit every project open in QElectroTech.
This commit is contained in:
@@ -32,16 +32,20 @@
|
||||
*/
|
||||
FreeTerminalEditor::FreeTerminalEditor(QETProject *project, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FreeTerminalEditor),
|
||||
m_project(project)
|
||||
ui(new Ui::FreeTerminalEditor),
|
||||
m_project(project)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->m_table_view->setItemDelegate(new FreeTerminalModelDelegate(ui->m_table_view));
|
||||
|
||||
m_model = new FreeTerminalModel(m_project, this);
|
||||
m_model = new FreeTerminalModel(m_project, this);
|
||||
ui->m_table_view->setModel(m_model);
|
||||
ui->m_table_view->setCurrentIndex(m_model->index(0,0));
|
||||
|
||||
if (m_project) {
|
||||
connect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
|
||||
}
|
||||
|
||||
//Disabled the move if the table is currently edited (yellow cell)
|
||||
connect(m_model, &FreeTerminalModel::dataChanged, this, [=] {
|
||||
this->setDisabledMove();
|
||||
@@ -135,6 +139,31 @@ void FreeTerminalEditor::apply()
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FreeTerminalEditor::setProject
|
||||
* Set @project as project handled by this editor.
|
||||
* If a previous project was setted, everything is clear.
|
||||
* This function track the destruction of the project,
|
||||
* that mean if the project pointer is deleted
|
||||
* no need to call this function with a nullptr,
|
||||
* everything is made inside this class.
|
||||
* @param project
|
||||
*/
|
||||
void FreeTerminalEditor::setProject(QETProject *project)
|
||||
{
|
||||
if(m_project) {
|
||||
disconnect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
|
||||
}
|
||||
m_project = project;
|
||||
if (m_model) {
|
||||
m_model->setProject(project);
|
||||
}
|
||||
if (m_project) {
|
||||
connect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
|
||||
}
|
||||
reload();
|
||||
}
|
||||
|
||||
void FreeTerminalEditor::on_m_type_cb_activated(int index)
|
||||
{
|
||||
if (m_model)
|
||||
|
||||
Reference in New Issue
Block a user