Fixing a small glitch when notifications and toolbox widgets interact

This commit is contained in:
Matthias Koefferlein 2026-01-18 22:12:47 +01:00
parent ddee74ab78
commit 659feb468c
1 changed files with 16 additions and 2 deletions

View File

@ -194,8 +194,22 @@ LayoutViewWidget::~LayoutViewWidget ()
void
LayoutViewWidget::add_toolbox_widget (lay::EditorOptionsPageWidget *toolbox_widget)
{
toolbox_widget->setParent (this);
mp_layout->insertWidget (0, toolbox_widget);
if (toolbox_widget->parent () != this) {
toolbox_widget->setParent (this);
// insert after the last notification widget
int index = 0;
for (int i = 0; i < mp_layout->count (); ++i) {
QLayoutItem *item = mp_layout->itemAt (i);
if (dynamic_cast<LayoutViewNotificationWidget *> (item)) {
index = i + 1;
}
}
mp_layout->insertWidget (index, toolbox_widget);
}
}
void