Commit 17f0e8b9 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

need to call leave/enter when destroying a workspace

parent a7ddca48
Pipeline #137303 passed with stage
in 0 seconds
......@@ -167,7 +167,9 @@ void dtkWidgetsWorkspaceBarPrivate::onItemClicked(int index)
void dtkWidgetsWorkspaceBarPrivate::onItemDestroyed(int index)
{
delete this->workspace_map.take(index);
auto deleted_workspace = this->workspace_map.take(index);
deleted_workspace->leave();
delete deleted_workspace;
q->removeTab(index);
......@@ -176,6 +178,8 @@ void dtkWidgetsWorkspaceBarPrivate::onItemDestroyed(int index)
q->QTabBar::setCurrentIndex(id);
this->current_workspace = dynamic_cast<dtkWidgetsWorkspace *>(this->stack->widget(id));
if (this->current_workspace)
this->current_workspace->enter();
for(int i = index; i < workspace_map.count() - 1; i++)
workspace_map[workspace_map.keys().at(i)] = workspace_map.values().at(i+1);
......@@ -282,7 +286,7 @@ void dtkWidgetsWorkspaceBar::createWorkspace(const QString &name, const QString&
if (d->current_workspace)
d->current_workspace->leave();
d->createWorkspace(d->workspace_colors[type], name, workspace, display_destroy); // this does: d->current_workspace = workspace;
d->createWorkspace(d->workspace_colors[type], name, workspace, display_destroy); // this does: d->current_workspace = workspace;
d->stack->addWidget(workspace);
d->stack->setCurrentWidget(workspace);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment