Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion framework/dockwindow/qml/Muse/Dock/dockpageview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,18 @@ bool DockPageView::isDockOpen(const QString& dockName) const

void DockPageView::toggleDock(const QString& dockName)
{
setDockOpen(dockName, !isDockOpen(dockName));
DockBase* dock = dockByName(dockName);
if (!dock) {
return;
}

DockPanelView* panel = dynamic_cast<DockPanelView*>(dock);
if (panel && panel->isOpen() && !panel->isCurrentTab()) {
panel->makeCurrentTab();
return;
}

setDockOpen(dockName, !dock->isOpen());
}

void DockPageView::setDockOpen(const QString& dockName, bool open)
Expand Down
12 changes: 12 additions & 0 deletions framework/dockwindow/qml/Muse/Dock/dockpanelview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,15 @@ void DockPanelView::setCurrentTabIndex(int index)
frame->setCurrentTabIndex(index);
}
}

bool DockPanelView::isCurrentTab() const
{
return dockWidget() && dockWidget()->isCurrentTab();
}

void DockPanelView::makeCurrentTab()
{
if (dockWidget()) {
dockWidget()->setAsCurrentTab();
}
}
2 changes: 2 additions & 0 deletions framework/dockwindow/qml/Muse/Dock/dockpanelview.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class DockPanelView : public DockBase
bool isTabAllowed(const DockPanelView* tab) const;
void addPanelAsTab(DockPanelView* tab);
void setCurrentTabIndex(int index);
bool isCurrentTab() const;
void makeCurrentTab();

public slots:
void setGroupName(const QString& name);
Expand Down