From 77e9b511cf6fe8709e832ced7334287ae683653c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 2 Dec 2022 17:32:18 +0100 Subject: [PATCH] Fixed slow 'show only selected' with many layers (reason: too many updates of recent editor options layer list) --- src/edt/edt/edtRecentConfigurationPage.cc | 10 ++++++++-- src/edt/edt/edtRecentConfigurationPage.h | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/edt/edt/edtRecentConfigurationPage.cc b/src/edt/edt/edtRecentConfigurationPage.cc index 84f831c8d..071527444 100644 --- a/src/edt/edt/edtRecentConfigurationPage.cc +++ b/src/edt/edt/edtRecentConfigurationPage.cc @@ -69,7 +69,7 @@ RecentConfigurationPage::init () } mp_tree_widget->setHeaderLabels (column_labels); - update_list (get_stored_values ()); + update_list (); } RecentConfigurationPage::~RecentConfigurationPage () @@ -314,11 +314,17 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std void RecentConfigurationPage::layers_changed (int) { - update_list (get_stored_values ()); + dm_update_list (); } void RecentConfigurationPage::technology_changed (const std::string &) +{ + dm_update_list (); +} + +void +RecentConfigurationPage::update_list () { update_list (get_stored_values ()); } diff --git a/src/edt/edt/edtRecentConfigurationPage.h b/src/edt/edt/edtRecentConfigurationPage.h index 00997fd0f..ba084dc20 100644 --- a/src/edt/edt/edtRecentConfigurationPage.h +++ b/src/edt/edt/edtRecentConfigurationPage.h @@ -27,6 +27,7 @@ #include "layEditorOptionsPage.h" #include "tlObject.h" +#include "tlDeferredExecution.h" #include #include @@ -79,7 +80,7 @@ public: template RecentConfigurationPage (lay::LayoutViewBase *view, lay::Dispatcher *dispatcher, const std::string &recent_cfg_name, Iter begin_cfg, Iter end_cfg) - : EditorOptionsPage (view, dispatcher), m_recent_cfg_name (recent_cfg_name), m_cfg (begin_cfg, end_cfg) + : EditorOptionsPage (view, dispatcher), m_recent_cfg_name (recent_cfg_name), m_cfg (begin_cfg, end_cfg), dm_update_list (this, &RecentConfigurationPage::update_list) { init (); } @@ -99,9 +100,11 @@ private: std::string m_recent_cfg_name; std::list m_cfg; QTreeWidget *mp_tree_widget; + tl::DeferredMethod dm_update_list; void init (); void update_list (const std::list > &stored_values); + void update_list (); std::list > get_stored_values () const; void set_stored_values (const std::list > &values) const; void render_to (QTreeWidgetItem *item, int column, const std::vector &values, RecentConfigurationPage::ConfigurationRendering rendering);