diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..3f1da8525 --- /dev/null +++ b/.clang-format @@ -0,0 +1,67 @@ +--- +BasedOnStyle: LLVM +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveMacros: 'true' +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignEscapedNewlines: Right +AlignOperands: 'true' +AlignTrailingComments: 'true' +AllowAllArgumentsOnNextLine: 'false' +AllowAllConstructorInitializersOnNextLine: 'true' +AllowAllParametersOfDeclarationOnNextLine: 'true' +AllowShortBlocksOnASingleLine: 'true' +AllowShortCaseLabelsOnASingleLine: 'true' +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Always +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: 'true' +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: 'true' +AlwaysBreakTemplateDeclarations: 'Yes' +BinPackArguments: 'false' +BinPackParameters: 'false' +BreakAfterJavaFieldAnnotations: 'true' +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: 'false' +BreakConstructorInitializers: AfterColon +BreakInheritanceList: AfterColon +BreakStringLiterals: 'true' +ColumnLimit: '80' +CompactNamespaces: 'false' +ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' +Cpp11BracedListStyle: 'true' +FixNamespaceComments: 'true' +IncludeBlocks: Regroup +IndentCaseLabels: 'false' +IndentPPDirectives: AfterHash +IndentWidth: '4' +JavaScriptWrapImports: 'true' +Language: Cpp +MaxEmptyLinesToKeep: '1' +NamespaceIndentation: All +PointerAlignment: Left +ReflowComments: 'true' +SortIncludes: 'true' +SortUsingDeclarations: 'true' +SpaceAfterCStyleCast: 'true' +SpaceAfterLogicalNot: 'true' +SpaceAfterTemplateKeyword: 'true' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeCpp11BracedList: 'true' +SpaceBeforeCtorInitializerColon: 'true' +SpaceBeforeInheritanceColon: 'true' +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: 'true' +SpaceInEmptyParentheses: 'false' +SpacesInAngles: 'false' +SpacesInCStyleCastParentheses: 'false' +SpacesInContainerLiterals: 'false' +SpacesInParentheses: 'false' +SpacesInSquareBrackets: 'false' +Standard: Cpp11 +TabWidth: '4' +UseTab: Always + +... diff --git a/lang/qet_da.qm b/lang/qet_da.qm index 50729bdc2..810cb4b3a 100644 Binary files a/lang/qet_da.qm and b/lang/qet_da.qm differ diff --git a/lang/qet_da.ts b/lang/qet_da.ts index 98ad424a0..19dd4385e 100644 --- a/lang/qet_da.ts +++ b/lang/qet_da.ts @@ -1625,7 +1625,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun Ouvrir un élément dialog title - Åbne symbol + Åbn symbol @@ -1649,7 +1649,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun Ouvrir une catégorie dialog title - Åbne kategori + Åbn kategori @@ -2111,7 +2111,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun Ouvrir la configuration sélectionné - Åbne valgt konfiguration + Åbn valgt konfiguration @@ -2287,7 +2287,7 @@ Bemærk: Disse muligheder VIL IKKE tillade eller blokere autonummereringer, kun Ouvrir le dossier correspondant - Åbne mappe + Åbn mappe @@ -2488,7 +2488,7 @@ Alle symboler og fil indhold bliver slettet. Ouvrir le dossier correspondant - Åbne mappe + Åbn mappe @@ -5629,7 +5629,7 @@ Kommandovalg: Affiche ou non le panel d'appareils - Vise eller skjule symbol panel + Vis eller skjul symbol panel @@ -5840,7 +5840,7 @@ Kommandovalg: Ouvre un projet existant status bar tip - Åbne eksisterende projekt + Åbn eksisterende projekt @@ -6017,12 +6017,12 @@ Kommandovalg: &Ouvrir - &Åbne + &Åbn Ouvrir un fichier - Åbne fil + Åbn fil @@ -6092,17 +6092,17 @@ Kommandovalg: Affiche ou non la barre d'outils principale - Vise eller skjule værktøjslinje + Vis eller skjul værktøjslinje Affiche ou non la barre d'outils Affichage - Vise eller skjule værktøjslinjen Vise + Vis eller skjul værktøjslinjen Vis Affiche ou non la barre d'outils Schéma - Vise eller skjule værktøjslinjen Diagram + Vis eller skjul værktøjslinjen Diagram @@ -6127,7 +6127,7 @@ Kommandovalg: Affiche ou non la liste des modifications - Vise eller skjule gendan liste + Vis eller skjul gendan liste @@ -6159,7 +6159,7 @@ Kommandovalg: Chercher/remplacer - Søge/erstatte + Søg/erstat @@ -6169,7 +6169,7 @@ Kommandovalg: &Récemment ouverts - &Seneste åbnet + &Senest åbnet @@ -6367,7 +6367,7 @@ Kommandovalg: Présente les différents projets ouverts dans des sous-fenêtres status bar tip - Vise åbne projekter i vinduer + Vis åbne projekter i vinduer @@ -6378,7 +6378,7 @@ Kommandovalg: Présente les différents projets ouverts des onglets status bar tip - Vise åbne projekter i faneblade + Vis åbne projekter i faneblade @@ -6541,7 +6541,7 @@ Kommandovalg: &Ouvrir - &Åbne + &Åbn @@ -6687,7 +6687,7 @@ Kommandovalg: &Ouvrir depuis un fichier - &Åbne fra fil + &Åbn fra fil @@ -6855,7 +6855,7 @@ Gør den kørbar: chmod +x ./DXFtoQET &Récemment ouverts - &Seneste åbnet + &Senest åbnet @@ -7102,7 +7102,7 @@ betingelser ikke gyldig Ouvrir un fichier dialog title - Åbne fil + Åbn fil @@ -7437,13 +7437,13 @@ Hvad skal ske? &Ouvrir menu entry - &Åbne + &Åbn Ouvrir depuis un fichier menu entry - Åbne fra fil + Åbn fra fil @@ -8591,27 +8591,27 @@ Voulez-vous la remplacer ? Chercher/remplacer les propriétés de folio - Søge/erstatte ark egenskaber + Søg/erstat ark egenskaber Chercher/remplacer les propriétés d'éléments. - Søge/erstatte symbol egenskaber. + Søg/erstat symbol egenskaber. Chercher/remplacer les propriétés de conducteurs. - Søge/erstatte ledere egenskaber. + Søg/erstat ledere egenskaber. Rechercher / remplacer avancé - Søge/erstatte avanceret + Søg/erstat avanceret Chercher/remplacer des textes independants - Søge/erstatte uafhængige tekste + Søg/erstat uafhængige tekste @@ -9999,13 +9999,13 @@ De andre felter anvendes ikke. Pink : HotPink element part color - + Lyserød : Varm lyserød Pink : DeepPink element part color - + Lyserød : Dyb lyserød @@ -10017,13 +10017,13 @@ De andre felter anvendes ikke. Pink : MediumVioletRed element part color - + Lyserød : Mellem violet rød Red : LightSalmon element part color - + Rød : Lys laks @@ -10035,7 +10035,7 @@ De andre felter anvendes ikke. Red : DarkSalmon element part color - + Rød : Mørk laks @@ -10047,7 +10047,7 @@ De andre felter anvendes ikke. Red : IndianRed element part color - + Rød : Indianer rød @@ -10060,7 +10060,7 @@ De andre felter anvendes ikke. Red : Firebrick element part color - + Rød : Ild fast sten @@ -11898,7 +11898,7 @@ De andre felter anvendes ikke. Information à afficher - Vise information + Vis information @@ -13122,7 +13122,7 @@ Maksimum længde: %2piksel Rechercher/Remplacer avancé - Søge/erstatte avanceret + Søg/erstat avanceret diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index f3f7f63a0..7cf06651f 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -282,9 +282,8 @@ void FileElementCollectionItem::setUpData() ElementsLocation loc(collectionPath()); DiagramContext context = loc.elementInformations(); QStringList search_list; - for (QString key : context.keys()) { - search_list.append(context.value(key).toString()); - } + for (QString& key : context.keys()) + { search_list.append(context.value(key).toString()); } search_list.append(localName(loc)); setData(search_list.join(" ")); } @@ -352,8 +351,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element) QDir dir (fileSystemPath()); //Get all directory in this directory. - for(auto str : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, - QDir::Name)) + for (auto& str : + dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) { FileElementCollectionItem *feci = new FileElementCollectionItem(); appendRow(feci); @@ -367,8 +366,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element) //Get all elmt file in this directory dir.setNameFilters(QStringList() << "*.elmt"); - for(auto str : dir.entryList(QDir::Files | QDir::NoDotAndDotDot, - QDir::Name)) + for (auto& str : + dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) { FileElementCollectionItem *feci = new FileElementCollectionItem(); appendRow(feci); diff --git a/sources/NameList/nameslist.cpp b/sources/NameList/nameslist.cpp index bd2bac29d..73e5d8e4f 100644 --- a/sources/NameList/nameslist.cpp +++ b/sources/NameList/nameslist.cpp @@ -229,28 +229,25 @@ bool NamesList::operator==(const NamesList &nl) const } /** - Return the adequate name regarding the current system locale. - By order of preference, this function chooses: - - the name in the system language - - the English name - - the provided fallback name if non-empty - - the first language encountered in the list - - an empty string - @param fallback_name name to be returned when no adequate name has been found - @return The adequate name regarding the current system locale. -*/ + * @brief NamesList::name + * Return the adequate name regarding the current system locale. + * By order of preference, this function chooses: + * - the name in the system language + * - the English name + * - the provided fallback name if non-empty + * - the first language encountered in the list + * - an empty string + * @param fallback_name + * name to be returned when no adequate name has been found + * @return The adequate name regarding the current system locale. + */ QString NamesList::name(const QString &fallback_name) const { QString system_language = QETApp::langFromSetting(); - QString returned_name; - if (!hash_names[system_language].isEmpty()) { - returned_name = hash_names[system_language]; - } else if (!hash_names["en"].isEmpty()) { - returned_name = hash_names["en"]; - } else if (!fallback_name.isEmpty()) { - returned_name = fallback_name; - } else if (hash_names.count()) { - returned_name = hash_names.value(hash_names.keys().first()); - } - return(returned_name); + if (! hash_names[system_language].isEmpty()) + return (hash_names[system_language]); + if (! hash_names["en"].isEmpty()) return (hash_names["en"]); + if (! fallback_name.isEmpty()) return (fallback_name); + if (hash_names.count()) return (hash_names.begin().value()); + return (QString("")); } diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index 0cd57524e..d234acbe5 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2006-2020 QElectroTech Team This file is part of QElectroTech. @@ -42,6 +42,28 @@ projectDataBase::projectDataBase(QETProject *project, QObject *parent) : m_project(project) { createDataBase(); + connect(m_project, &QETProject::diagramAdded, [this](QETProject *, Diagram *diagram) { + this->addDiagram(diagram); + }); + connect(m_project, &QETProject::diagramRemoved, [this](QETProject *, Diagram *diagram) { + this->removeDiagram(diagram); + }); + connect(m_project, &QETProject::projectDiagramsOrderChanged, [this]() + { + for (auto diagram : m_project->diagrams()) + { + m_diagram_order_changed.bindValue(":pos", m_project->folioIndex(diagram)+1); + m_diagram_order_changed.bindValue(":uuid", diagram->uuid()); + m_diagram_order_changed.exec(); + + + m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio")); + m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid()); + m_diagram_info_order_changed.exec(); + + } + emit dataBaseUpdated(); + }); } /** @@ -151,33 +173,29 @@ void projectDataBase::elementInfoChanged(Element *element) void projectDataBase::addDiagram(Diagram *diagram) { m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString()); - m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)); + m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)+1); if(!m_insert_diagram_query.exec()) { qDebug() << "projectDataBase::addDiagram insert error : " << m_insert_diagram_query.lastError(); } - - m_insert_diagram_info_query.bindValue(":uuid", diagram->uuid()); - auto infos = diagram->border_and_titleblock.titleblockInformation(); - for (auto key : QETApp::diagramInfoKeys()) - { - if (key == "date") - { - m_insert_diagram_info_query.bindValue( ":date", - QLocale::system().toDate(infos.value("date").toString(), - QLocale::ShortFormat)); - } else { - auto value = infos.value(key); - auto bind = key.prepend(":"); - m_insert_diagram_info_query.bindValue(bind, value); - } - } + bindDiagramInfoValues(m_insert_diagram_info_query, diagram); if (!m_insert_diagram_info_query.exec()) { qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError(); - } else { - emit dataBaseUpdated(); } + + //The information "folio" of other existing diagram can have the variable %total, + //so when a new diagram is added this variable change. + //We need to update this information in the database. + for (auto diagram : project()->diagrams()) + { + m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio")); + m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid()); + if (!m_diagram_info_order_changed.exec()) { + qDebug() << "projectDataBase::addDiagram update diagram infp order error : " << m_diagram_info_order_changed.lastError(); + } + } + emit dataBaseUpdated(); } void projectDataBase::removeDiagram(Diagram *diagram) @@ -190,6 +208,21 @@ void projectDataBase::removeDiagram(Diagram *diagram) } } +void projectDataBase::diagramInfoChanged(Diagram *diagram) +{ + bindDiagramInfoValues(m_update_diagram_info_query, diagram); + + if (!m_update_diagram_info_query.exec()) { + qDebug() << "projectDataBase::diagramInfoChanged update error : " << m_update_diagram_info_query.lastError(); + } else { + emit dataBaseUpdated(); + } +} + +void projectDataBase::diagramOrderChanged() +{ +} + /** @brief projectDataBase::createDataBase Create the data base @@ -342,7 +375,7 @@ void projectDataBase::populateDiagramTable() for (auto diagram : m_project->diagrams()) { m_insert_diagram_query.bindValue(":uuid", diagram->uuid().toString()); - m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)); + m_insert_diagram_query.bindValue(":pos", m_project->folioIndex(diagram)+1); if(!m_insert_diagram_query.exec()) { qDebug() << "projectDataBase::populateDiagramTable insert error : " << m_insert_diagram_query.lastError(); } @@ -417,21 +450,7 @@ void projectDataBase::populateDiagramInfoTable() for (auto *diagram : m_project->diagrams()) { - m_insert_diagram_info_query.bindValue(":uuid", diagram->uuid()); - - auto infos = diagram->border_and_titleblock.titleblockInformation(); - for (auto key : QETApp::diagramInfoKeys()) - { - if (key == "date") { - m_insert_diagram_info_query.bindValue( ":date", - QLocale::system().toDate(infos.value("date").toString(), - QLocale::ShortFormat)); - } else { - auto value = infos.value(key); - auto bind = key.prepend(":"); - m_insert_diagram_info_query.bindValue(bind, value); - } - } + bindDiagramInfoValues(m_insert_diagram_info_query, diagram); if (!m_insert_diagram_info_query.exec()) { qDebug() << "projectDataBase::populateDiagramInfoTable insert error : " << m_insert_diagram_info_query.lastError(); @@ -462,6 +481,22 @@ void projectDataBase::prepareQuery() ")"); m_insert_diagram_info_query.prepare(insert_diag_info); + //UPDATE DIAGRAM INFO + QString update_diagram_str("UPDATE diagram_info SET "); + for (auto str : QETApp::diagramInfoKeys()) { + update_diagram_str.append(str + " = :" + str + ", "); + } + update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", " + update_diagram_str.append(" WHERE diagram_uuid = :uuid"); + m_update_diagram_info_query = QSqlQuery(m_data_base); + m_update_diagram_info_query.prepare(update_diagram_str); + + //UPDATE DIAGRAM ORDER + m_diagram_order_changed = QSqlQuery(m_data_base); + m_diagram_order_changed.prepare("UPDATE diagram SET pos = :pos WHERE uuid = :uuid"); + m_diagram_info_order_changed = QSqlQuery(m_data_base); + m_diagram_info_order_changed.prepare("UPDATE diagram_info SET folio = :folio WHERE diagram_uuid = :uuid"); + //INSERT ELEMENT QString insert_element_query("INSERT INTO element (uuid, diagram_uuid, pos, type, sub_type) VALUES (:uuid, :diagram_uuid, :pos, :type, :sub_type)"); m_insert_elements_query = QSqlQuery(m_data_base); @@ -518,6 +553,25 @@ QHash projectDataBase::elementInfoToString(Element *elmt) return hash; } +void projectDataBase::bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram) +{ + query.bindValue(":uuid", diagram->uuid()); + + auto infos = diagram->border_and_titleblock.titleblockInformation(); + for (auto key : QETApp::diagramInfoKeys()) + { + if (key == "date") { + query.bindValue( ":date", + QLocale::system().toDate(infos.value("date").toString(), + QLocale::ShortFormat)); + } else { + auto value = infos.value(key); + auto bind = key.prepend(":"); + query.bindValue(bind, value); + } + } +} + #ifdef QET_EXPORT_PROJECT_DB /** @brief projectDataBase::sqliteHandle diff --git a/sources/dataBase/projectdatabase.h b/sources/dataBase/projectdatabase.h index 2fe470f87..9b7603979 100644 --- a/sources/dataBase/projectdatabase.h +++ b/sources/dataBase/projectdatabase.h @@ -47,11 +47,15 @@ class projectDataBase : public QObject void updateDB(); QETProject *project() const; QSqlQuery newQuery(const QString &query = QString()); - void addElement(Element *element); - void removeElement(Element *element); - void elementInfoChanged(Element *element); - void addDiagram(Diagram *diagram); - void removeDiagram(Diagram *diagram); + + void addElement (Element *element); + void removeElement (Element *element); + void elementInfoChanged (Element *element); + + void addDiagram (Diagram *diagram); + void removeDiagram (Diagram *diagram); + void diagramInfoChanged (Diagram *diagram); + void diagramOrderChanged(); signals: void dataBaseUpdated(); @@ -67,6 +71,7 @@ class projectDataBase : public QObject void prepareQuery(); static QHash elementInfoToString( Element *elmt); + void bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram); private: QPointer m_project; @@ -77,7 +82,10 @@ class projectDataBase : public QObject m_update_element_query, m_insert_diagram_query, m_remove_diagram_query, - m_insert_diagram_info_query; + m_insert_diagram_info_query, + m_update_diagram_info_query, + m_diagram_order_changed, + m_diagram_info_order_changed; #ifdef QET_EXPORT_PROJECT_DB public: diff --git a/sources/dataBase/ui/summaryquerywidget.cpp b/sources/dataBase/ui/summaryquerywidget.cpp index 6c54dedc9..3fc7e5b72 100644 --- a/sources/dataBase/ui/summaryquerywidget.cpp +++ b/sources/dataBase/ui/summaryquerywidget.cpp @@ -61,6 +61,7 @@ QString SummaryQueryWidget::queryStr() const QStringList keys = selectedKeys(); QString select ="SELECT "; + QString order_by = " ORDER BY "; QString column; bool first = true; @@ -69,13 +70,15 @@ QString SummaryQueryWidget::queryStr() const first = false; } else { column += ", "; + order_by +=", "; } column += key; + order_by += key; } QString from = " FROM project_summary_view"; - QString q(select + column + from); + QString q(select + column + from + order_by); return q; } diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 5414c35bb..f93e0bcfe 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -1650,6 +1650,8 @@ void Diagram::setTitleBlockTemplate(const QString &template_name) if (template_name != current_name) emit(usedTitleBlockTemplateChanged(template_name)); + + project()->dataBase()->diagramInfoChanged(this); } /** diff --git a/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp b/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp index a023be1a6..8301e0548 100644 --- a/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp +++ b/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp @@ -441,5 +441,7 @@ void QetGraphicsHeaderItem::adjustSize() void QetGraphicsHeaderItem::modelReseted() { setUpMinimumSectionsSize(); + m_current_sections_width.clear(); + m_current_sections_width.resize(m_sections_minimum_width.size()); adjustSize(); } diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index e12132489..401bf644d 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -1015,12 +1015,13 @@ bool Element::fromXml( if(deti->textFrom()== DynamicElementTextItem::ElementInfo && deti->infoName() == "label") { + qDebug() << "see 'Mod overlapping comparisons' in git"; qreal rotation = deti->rotation(); //Create the comment item DynamicElementTextItem *comment_text = nullptr; - if (m_link_type !=PreviousReport - || m_link_type !=NextReport) + if (m_link_type != PreviousReport + && m_link_type != NextReport) { m_state = QET::GIOK; return(true); @@ -1041,7 +1042,8 @@ bool Element::fromXml( } //create the location item DynamicElementTextItem *location_text = nullptr; - if (m_link_type !=PreviousReport || m_link_type !=NextReport) + if (m_link_type != PreviousReport + && m_link_type != NextReport) { m_state = QET::GIOK; return(true); @@ -1061,8 +1063,8 @@ bool Element::fromXml( } QPointF pos = deti->pos(); - if (m_link_type !=PreviousReport - || m_link_type !=NextReport) + if (m_link_type != PreviousReport + && m_link_type != NextReport) { m_state = QET::GIOK; return(true); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 4e8238d3e..5d059ec2b 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -1221,7 +1221,6 @@ void QETProject::removeDiagram(Diagram *diagram) if (m_diagrams_list.removeAll(diagram)) { - m_data_base.removeDiagram(diagram); emit(diagramRemoved(this, diagram)); diagram->deleteLater(); } @@ -1652,7 +1651,7 @@ void QETProject::addDiagram(Diagram *diagram, int pos) } else { m_diagrams_list.insert(pos, diagram); } - m_data_base.addDiagram(diagram); + updateDiagramsFolioData(); }