From a088b0e1c79836220be2ba250342ab3daf98eb68 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Fri, 18 Mar 2022 23:12:43 +0800 Subject: [PATCH] edit dictionaries panel ,update refresh change --- editdictionaries.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/editdictionaries.cc b/editdictionaries.cc index 3d4fe595..79b14e11 100644 --- a/editdictionaries.cc +++ b/editdictionaries.cc @@ -213,10 +213,9 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) groupInstances.clear(); // Those hold pointers to dictionaries, we need to // free them. - ui.tabs->setUpdatesEnabled( false ); - ui.tabs->removeTab( 1 ); - ui.tabs->removeTab( 1 ); + + groups.reset(); orderAndProps.reset(); @@ -247,12 +246,14 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) if ( rebuildGroups ) { orderAndProps = new OrderAndProps( this, savedOrder, savedInactive, dictionaries, dictMap ); + groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); + + ui.tabs->removeTab( 1 ); + ui.tabs->removeTab( 1 ); ui.tabs->insertTab( 1, orderAndProps.get(), QIcon(":/icons/book.svg"), tr( "&Dictionaries" ) ); - groups = new Groups( this, dictionaries, savedGroups, orderAndProps->getCurrentDictionaryOrder() ); ui.tabs->insertTab( 2, groups.get(), QIcon(":/icons/bookcase.svg"), tr( "&Groups" ) ); - ui.tabs->setUpdatesEnabled( true ); if ( noGroupEdits ) origCfg.groups = groups->getGroups(); @@ -263,6 +264,8 @@ void EditDictionaries::acceptChangedSources( bool rebuildGroups ) if ( noInactiveEdits ) origCfg.inactiveDictionaries = orderAndProps->getCurrentInactiveDictionaries(); } + ui.tabs->setUpdatesEnabled( true ); + } void EditDictionaries::helpRequested()