Properly populating the editor options pages

This commit is contained in:
Matthias Koefferlein 2023-01-29 00:12:31 +01:00
parent 99825e2e24
commit 1a1139299a
2 changed files with 20 additions and 13 deletions

View File

@ -638,6 +638,8 @@ void LayoutView::do_setup_editor_options_pages ()
(*op)->setup (this);
}
}
activate_editor_option_pages ();
}
void LayoutView::side_panel_destroyed (QObject *sender)
@ -1437,23 +1439,26 @@ void
LayoutView::mode (int m)
{
if (mode () != m) {
LayoutViewBase::mode (m);
activate_editor_option_pages ();
}
}
lay::EditorOptionsPages *eo_pages = editor_options_pages ();
if (eo_pages) {
void
LayoutView::activate_editor_option_pages ()
{
lay::EditorOptionsPages *eo_pages = editor_options_pages ();
if (eo_pages) {
// TODO: this is very inefficient as each "activate" will regenerate the tabs
for (std::vector<lay::EditorOptionsPage *>::const_iterator op = eo_pages->pages ().begin (); op != eo_pages->pages ().end (); ++op) {
bool is_active = false;
if ((*op)->plugin_declaration () == 0) {
is_active = true;
} else if (active_plugin () && active_plugin ()->plugin_declaration () == (*op)->plugin_declaration ()) {
is_active = true;
}
(*op)->activate (is_active);
// TODO: this is very inefficient as each "activate" will regenerate the tabs
for (std::vector<lay::EditorOptionsPage *>::const_iterator op = eo_pages->pages ().begin (); op != eo_pages->pages ().end (); ++op) {
bool is_active = false;
if ((*op)->plugin_declaration () == 0) {
is_active = true;
} else if (active_plugin () && active_plugin ()->plugin_declaration () == (*op)->plugin_declaration ()) {
is_active = true;
}
(*op)->activate (is_active);
}
}

View File

@ -679,6 +679,8 @@ protected:
private:
using LayoutViewBase::ui;
void activate_editor_option_pages ();
};
/**