diff --git a/sources/autoNum/ui/autonumberingdockwidget.cpp b/sources/autoNum/ui/autonumberingdockwidget.cpp index 9f094801b..d27a5042f 100644 --- a/sources/autoNum/ui/autonumberingdockwidget.cpp +++ b/sources/autoNum/ui/autonumberingdockwidget.cpp @@ -26,6 +26,7 @@ #include "../numerotationcontext.h" #include "../numerotationcontextcommands.h" #include "ui_autonumberingdockwidget.h" +#include "../../undocommand/changetitleblockcommand.h" #include #include @@ -347,10 +348,17 @@ void AutoNumberingDockWidget::on_m_folio_cb_activated(int) { ip.folio = "%id/%total"; m_project->setDefaultTitleBlockProperties(ip); } + if (m_project_view && m_project_view->currentDiagram()) { - m_project_view->currentDiagram()->diagram()->border_and_titleblock.importTitleBlock(ip); + Diagram *diagram = m_project_view->currentDiagram()->diagram(); + TitleBlockProperties old_properties = diagram->border_and_titleblock.exportTitleBlock(); + TitleBlockProperties new_properties = old_properties; + new_properties.auto_page_num = ip.auto_page_num; + new_properties.folio = ip.folio; + if (new_properties != old_properties) + diagram->undoStack().push(new ChangeTitleBlockCommand(diagram, old_properties, new_properties)); } -emit(folioAutoNumChanged(current_autonum)); + emit(folioAutoNumChanged(current_autonum)); refreshRow(AutoNumCategory::Folio); } diff --git a/sources/qetproject.h b/sources/qetproject.h index b08e2b5b4..3817abad9 100644 --- a/sources/qetproject.h +++ b/sources/qetproject.h @@ -244,7 +244,6 @@ class QETProject : public QObject /// rebuild their rule lists; this one just says "re-read me". void autoNumContextUpdated(); void folioAutoNumRemoved(); - void folioAutoNumChanged(QString); void defaultTitleBlockPropertiesChanged(); void conductorAutoNumChanged(); diff --git a/sources/ui/configpage/projectconfigpages.cpp b/sources/ui/configpage/projectconfigpages.cpp index 22da41ebe..0a95c3c10 100644 --- a/sources/ui/configpage/projectconfigpages.cpp +++ b/sources/ui/configpage/projectconfigpages.cpp @@ -503,6 +503,10 @@ void ProjectAutoNumConfigPage::removeContextElement() return; m_project->removeElementAutoNum (m_saw_element->contextComboBox()->currentText()); m_saw_element->contextComboBox()->removeItem (m_saw_element->contextComboBox()->currentIndex()); + // removeItem() removes the current selection programmatically but + // textActivated() does not react to (by design, see buildConnections()). + // Refresh the displayed pattern explicitly so it matches the new selection. + updateContextElement(m_saw_element->contextComboBox()->currentText()); } /** @@ -690,6 +694,10 @@ void ProjectAutoNumConfigPage::removeContextConductor() if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return; m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() ); m_saw_conductor->contextComboBox()-> removeItem (m_saw_conductor->contextComboBox()-> currentIndex() ); + // removeItem() removes the current selection programmatically but + // textActivated() does not react to (by design, see buildConnections()). + // Refresh the displayed pattern explicitly so it matches the new selection. + updateContextConductor(m_saw_conductor->contextComboBox()->currentText()); project()->conductorAutoNumRemoved(); } @@ -703,6 +711,10 @@ void ProjectAutoNumConfigPage::removeContextFolio() if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return; m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() ); m_saw_folio->contextComboBox() -> removeItem (m_saw_folio->contextComboBox() -> currentIndex() ); + // removeItem() removes the current selection programmatically but + // textActivated() does not react to (by design, see buildConnections()). + // Refresh the displayed pattern explicitly so it matches the new selection. + updateContextFolio(m_saw_folio->contextComboBox()->currentText()); project()->folioAutoNumRemoved(); }