Another performance fix for the many layers case

This commit is contained in:
Matthias Koefferlein 2022-12-28 17:15:51 +01:00
parent 1ad7dc0d98
commit de6e1ffd53
2 changed files with 10 additions and 1 deletions

View File

@ -326,7 +326,7 @@ struct LayerSelectionComboBoxPrivateData
}; };
LayerSelectionComboBox::LayerSelectionComboBox (QWidget *parent) LayerSelectionComboBox::LayerSelectionComboBox (QWidget *parent)
: QComboBox (parent) : QComboBox (parent), dm_update_layer_list (this, &LayerSelectionComboBox::do_update_layer_list)
{ {
mp_private = new LayerSelectionComboBoxPrivateData (); mp_private = new LayerSelectionComboBoxPrivateData ();
mp_private->no_layer_available = false; mp_private->no_layer_available = false;
@ -471,6 +471,12 @@ LayerSelectionComboBox::set_layout (const db::Layout *layout)
void void
LayerSelectionComboBox::update_layer_list () LayerSelectionComboBox::update_layer_list ()
{
dm_update_layer_list ();
}
void
LayerSelectionComboBox::do_update_layer_list ()
{ {
int i = currentIndex (); int i = currentIndex ();
db::LayerProperties props = mp_private->last_props; db::LayerProperties props = mp_private->last_props;

View File

@ -28,6 +28,7 @@
#include "layuiCommon.h" #include "layuiCommon.h"
#include "tlObject.h" #include "tlObject.h"
#include "tlDeferredExecution.h"
#include <QPushButton> #include <QPushButton>
#include <QComboBox> #include <QComboBox>
@ -251,9 +252,11 @@ protected slots:
private: private:
LayerSelectionComboBoxPrivateData *mp_private; LayerSelectionComboBoxPrivateData *mp_private;
tl::DeferredMethod<LayerSelectionComboBox> dm_update_layer_list;
void on_layer_list_changed (int); void on_layer_list_changed (int);
void update_layer_list (); void update_layer_list ();
void do_update_layer_list ();
}; };
/** /**