Merge pull request #1362 from KLayout/issue-1360

Fixed issue #1360 (LayoutViewBase not promoted to LayoutView). Proble…
This commit is contained in:
Matthias Köfferlein 2023-05-12 23:31:41 +02:00 committed by GitHub
commit 7169910607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 15 deletions

View File

@ -260,8 +260,6 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, db::Manager *manager, bool
{ {
// either it's us or the parent has a dispatcher // either it's us or the parent has a dispatcher
tl_assert (dispatcher () != 0); tl_assert (dispatcher () != 0);
init (manager);
} }
void void

View File

@ -192,11 +192,6 @@ public:
*/ */
LayoutViewBase (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); LayoutViewBase (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);
/**
* @brief Constructor
*/
LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);
/** /**
* @brief Destructor * @brief Destructor
*/ */
@ -2869,8 +2864,6 @@ private:
tl::Clock m_clock, m_last_checked; tl::Clock m_clock, m_last_checked;
void init (db::Manager *mgr);
void do_prop_changed (); void do_prop_changed ();
void do_redraw (int layer); void do_redraw (int layer);
void do_redraw (); void do_redraw ();
@ -2901,6 +2894,13 @@ private:
void merge_dither_pattern (lay::LayerPropertiesList &props); void merge_dither_pattern (lay::LayerPropertiesList &props);
protected: protected:
/**
* @brief Constructor for calling from a LayoutView
*/
LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);
void init (db::Manager *mgr);
lay::Plugin *active_plugin () const lay::Plugin *active_plugin () const
{ {
return mp_active_plugin; return mp_active_plugin;

View File

@ -30,6 +30,8 @@ namespace lay
LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options)
: LayoutViewBase (this, mgr, editable, plugin_parent, options) : LayoutViewBase (this, mgr, editable, plugin_parent, options)
{ {
// NOTE: it's important to call LayoutViewBase::init from a fully constructed LayoutView (issue #1360)
LayoutViewBase::init (mgr);
config_setup (); config_setup ();
finish (); finish ();
} }
@ -37,6 +39,8 @@ LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_par
LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options)
: LayoutViewBase (this, mgr, editable, plugin_parent, options) : LayoutViewBase (this, mgr, editable, plugin_parent, options)
{ {
// NOTE: it's important to call LayoutViewBase::init from a fully constructed LayoutView (issue #1360)
LayoutViewBase::init (mgr);
copy_from (source); copy_from (source);
config_setup (); config_setup ();
finish (); finish ();

View File

@ -279,7 +279,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
// ensures the deferred method scheduler is present // ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance (); tl::DeferredMethodScheduler::instance ();
init_ui (); init_ui (manager);
} }
LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options) LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options)
@ -290,7 +290,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
// ensures the deferred method scheduler is present // ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance (); tl::DeferredMethodScheduler::instance ();
init_ui (); init_ui (manager);
copy_from (source); copy_from (source);
@ -306,7 +306,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
// ensures the deferred method scheduler is present // ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance (); tl::DeferredMethodScheduler::instance ();
init_ui (); init_ui (manager);
} }
LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options) LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options)
@ -317,7 +317,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
// ensures the deferred method scheduler is present // ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance (); tl::DeferredMethodScheduler::instance ();
init_ui (); init_ui (manager);
copy_from (source); copy_from (source);
@ -349,7 +349,7 @@ LayoutView::event_filter (QObject *obj, QEvent *event, bool &taken)
} }
void void
LayoutView::init_ui () LayoutView::init_ui (db::Manager *mgr)
{ {
m_activated = true; m_activated = true;
m_always_show_source = false; m_always_show_source = false;
@ -373,6 +373,10 @@ LayoutView::init_ui ()
mp_min_hier_spbx = 0; mp_min_hier_spbx = 0;
mp_max_hier_spbx = 0; mp_max_hier_spbx = 0;
// NOTE: it's important to call LayoutViewBase::init from LayoutView because creating the plugins will need a
// fully constructed LayoutView (issue #1360)
LayoutViewBase::init (mgr);
if (mp_widget) { if (mp_widget) {
canvas ()->init_ui (mp_widget); canvas ()->init_ui (mp_widget);

View File

@ -627,7 +627,7 @@ private:
bool event_filter (QObject *obj, QEvent *ev, bool &taken); bool event_filter (QObject *obj, QEvent *ev, bool &taken);
QSize size_hint () const; QSize size_hint () const;
void init_ui (); void init_ui (db::Manager *manager);
void do_setup_editor_options_pages (); void do_setup_editor_options_pages ();
QWidget *layer_control_frame () { return mp_control_frame; } QWidget *layer_control_frame () { return mp_control_frame; }