Fixed issue #1360 (LayoutViewBase not promoted to LayoutView). Problem was that GSI binding of LayoutView happened before LayoutView was fully constructed.

This commit is contained in:
Matthias Koefferlein 2023-05-09 20:06:34 +02:00
parent 34d147f1ce
commit df7311ddf7
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
tl_assert (dispatcher () != 0);
init (manager);
}
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);
/**
* @brief Constructor
*/
LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal);
/**
* @brief Destructor
*/
@ -2861,8 +2856,6 @@ private:
tl::Clock m_clock, m_last_checked;
void init (db::Manager *mgr);
void do_prop_changed ();
void do_redraw (int layer);
void do_redraw ();
@ -2891,6 +2884,13 @@ private:
void merge_dither_pattern (lay::LayerPropertiesList &props);
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
{
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)
: 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 ();
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)
: 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);
config_setup ();
finish ();

View File

@ -279,7 +279,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
// ensures the deferred method scheduler is present
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)
@ -290,7 +290,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();
init_ui ();
init_ui (manager);
copy_from (source);
@ -306,7 +306,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin
// ensures the deferred method scheduler is present
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)
@ -317,7 +317,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
// ensures the deferred method scheduler is present
tl::DeferredMethodScheduler::instance ();
init_ui ();
init_ui (manager);
copy_from (source);
@ -349,7 +349,7 @@ LayoutView::event_filter (QObject *obj, QEvent *event, bool &taken)
}
void
LayoutView::init_ui ()
LayoutView::init_ui (db::Manager *mgr)
{
m_activated = true;
m_always_show_source = false;
@ -373,6 +373,10 @@ LayoutView::init_ui ()
mp_min_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) {
canvas ()->init_ui (mp_widget);

View File

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