Commit 689305c9 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

call enter/leave workspace methods

parent f4ac42da
......@@ -198,6 +198,7 @@ public:
QList<QColor> colors;
QList<QMenu *> submenus;
QStringList workspaces;
dtkWidgetsWorkspace *current_workspace = nullptr;
};
void dtkWidgetsWorkspaceBarPrivate::createWorkspace(const QColor & color, const QString& name, bool display_destroy)
......@@ -240,6 +241,12 @@ void dtkWidgetsWorkspaceBarPrivate::onItemClicked(int index)
q->emit indexChanged(index);
this->stack->setCurrentIndex(index);
dtkWidgetsWorkspace *workspace = dynamic_cast<dtkWidgetsWorkspace*>(this->stack->currentWidget());
if (workspace != this->current_workspace) {
this->current_workspace->leave();
this->current_workspace = workspace;
this->current_workspace->enter();
}
for (dtkWidgetsWorkspaceBarItem *item : items) {
int current_index = items.indexOf(item);
......@@ -357,6 +364,10 @@ void dtkWidgetsWorkspaceBar::createWorkspace(const QString &name, const QString&
d->stack->addWidget(workspace);
d->stack->setCurrentWidget(workspace);
if (d->current_workspace)
d->current_workspace->leave();
workspace->enter();
d->current_workspace = workspace;
}
dtkWidgetsWorkspaceBar::~dtkWidgetsWorkspaceBar(void)
......
Markdown is supported
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