diff --git a/GUI/Models/Data/ApplicationModels.cpp b/GUI/Models/Data/ApplicationModels.cpp index c34aa35cc982878d922aaab2c0d04d26158a587c..73a18a4f750f72e9f8b5eb02a5d356b4e397a628 100644 --- a/GUI/Models/Data/ApplicationModels.cpp +++ b/GUI/Models/Data/ApplicationModels.cpp @@ -111,7 +111,6 @@ void ApplicationModels::writeTo(QXmlStreamWriter* writer) void ApplicationModels::readFrom(QXmlStreamReader* reader, MessageService* messageService) { try { - for (auto model : modelList()) { if (model->getModelTag() == reader->name()) { model->readFrom(reader, messageService); @@ -147,12 +146,12 @@ QVector<SessionItem*> ApplicationModels::nonXMLItems() const void ApplicationModels::connectModel(SessionModel* model) const { - if (model) { - connect(model, &SessionModel::dataChanged, this, &ApplicationModels::modelChanged, - Qt::UniqueConnection); - connect(model, &SessionModel::rowsRemoved, this, &ApplicationModels::modelChanged, - Qt::UniqueConnection); - connect(model, &SessionModel::rowsInserted, this, &ApplicationModels::modelChanged, - Qt::UniqueConnection); - } + if (!model) + return; + connect(model, &SessionModel::dataChanged, this, &ApplicationModels::modelChanged, + Qt::UniqueConnection); + connect(model, &SessionModel::rowsRemoved, this, &ApplicationModels::modelChanged, + Qt::UniqueConnection); + connect(model, &SessionModel::rowsInserted, this, &ApplicationModels::modelChanged, + Qt::UniqueConnection); }